You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Isuru Nishan <is...@yahoo.com> on 2005/09/06 12:16:34 UTC
String Formatting Problem
Hi All,
I wan to get the results coming from the template
$fileelementlist.get(2).get(0).getTourID()$fileelementlist.get(2).get(0).getTotalSeats()
and
#set($isautopnr=$fileelementlist.get(2).get(0).isIsautomatedpnraddress())
#if($isautopnr)
$fileelementlist.get(2).get(0).getElementId()$fileelementlist.get(2).get(0).getAutomatedPNR()
#end
to the same line.
When I run this two templates results are in two different lines.I want to get them to the same line.Pls help!!!
ISuru
---------------------------------
Click here to donate to the Hurricane Katrina relief effort.
Re: String Formatting Problem
Posted by Christian Reichlin <ch...@kerbtier.ch>.
hi,
try it like this:
#set($content = "$fileelementlist.get(2).get(0).getTourID()$fileelementlist.get(2).get(0).getTotalSeats()")
#set($isautopnr=$fileelementlist.get(2).get(0).isIsautomatedpnraddress())
#if($isautopnr)
#set($content = "${content}$fileelementlist.get(2).get(0).getElementId()$fileelementlist.get(2).get(0).getAutomatedPNR()")
#end
$content
i didn't test it but it should work. i don't know if there is a more
elegant solution.
christian
Isuru Nishan wrote:
>Hi All,
>
>I wan to get the results coming from the template
>#set($content = "$fileelementlist.get(2).get(0).getTourID()$fileelementlist.get(2).get(0).getTotalSeats()")
>
>
>and
>
>#set($isautopnr=$fileelementlist.get(2).get(0).isIsautomatedpnraddress())
>
>#if($isautopnr)
>
>#set($content = "${content}$fileelementlist.get(2).get(0).getElementId()$fileelementlist.get(2).get(0).getAutomatedPNR()")
>
>#end
>
>$content
>
>to the same line.
>
>
>
>When I run this two templates results are in two different lines.I want to get them to the same line.Pls help!!!
>
>ISuru
>
>
>
>---------------------------------
> Click here to donate to the Hurricane Katrina relief effort.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: String Formatting Problem
Posted by Nathan Bubna <nb...@gmail.com>.
you can always just comment out all the whitespace between the lines
you wish to be connected...
$foo#*
*##set( $bar = $tool.baz )##
#if( $bar )#*
*#$tool.woogie
#end
On 9/6/05, Isuru Nishan <is...@yahoo.com> wrote:
> Hi All,
>
> I wan to get the results coming from the template
> $fileelementlist.get(2).get(0).getTourID()$fileelementlist.get(2).get(0).getTotalSeats()
>
>
> and
>
> #set($isautopnr=$fileelementlist.get(2).get(0).isIsautomatedpnraddress())
>
> #if($isautopnr)
>
> $fileelementlist.get(2).get(0).getElementId()$fileelementlist.get(2).get(0).getAutomatedPNR()
>
> #end
>
>
>
> to the same line.
>
>
>
> When I run this two templates results are in two different lines.I want to get them to the same line.Pls help!!!
>
> ISuru
>
>
>
> ---------------------------------
> Click here to donate to the Hurricane Katrina relief effort.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org