You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Skondras Panagiotis <pa...@acn.gr> on 2001/01/24 15:00:48 UTC
Velocity VTL
Hi
I would like to ask something about the Velocity
I need to have a $Test.getSomething().getElse(
$PrevTest.getPTest().getPTElse() )
The $Prev is in the Context
The $Test is in the Context.
When i try the above i get nothing
but when i do
$Test.getSomething().getElse( "SomeValue" )
I get Results can someone explain this please
Also i tried
#set ($Temp = $PrevTest.getPTest().getPTElse() )
$Test.getSomething().getElse( $Temp )
I get the same no output i also put the $Temp as ${Temp}
no luck
thx in advance
Re: Velocity VTL
Posted by Skondras Panagiotis <pa...@acn.gr>.
You are right the $Temp is a long when
it is returned but the getElse requires a String
"Geir Magnusson Jr." wrote:
> Skondras Panagiotis wrote:
> >
> > Hi
> >
> > Thx for the answer but i have just
> > find out that if you put the $Temp
> > in quotes "$Temp" it's ok
>
> No, something screwy is going on.
>
> You aren't required to put reference arguments in quotes : what that
> does for you is evaluate whatever $Temp is...
>
> What is the method signature of getElse( arg )? What is the type of
> 'arg' ? I assume it's a String, and I assume $Temp isn't a String?
>
> geir
>
> > RTFM i guess
> > thx for your time
>
> --
> Geir Magnusson Jr. geirm@optonline.com
> Velocity : it's not just a good idea. It should be the law.
> http://jakarta.apache.org/velocity
Re: Velocity VTL
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Skondras Panagiotis wrote:
>
> Hi
>
> Thx for the answer but i have just
> find out that if you put the $Temp
> in quotes "$Temp" it's ok
No, something screwy is going on.
You aren't required to put reference arguments in quotes : what that
does for you is evaluate whatever $Temp is...
What is the method signature of getElse( arg )? What is the type of
'arg' ? I assume it's a String, and I assume $Temp isn't a String?
geir
> RTFM i guess
> thx for your time
--
Geir Magnusson Jr. geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity
Re: Velocity VTL
Posted by Skondras Panagiotis <pa...@acn.gr>.
Hi
Thx for the answer but i have just
find out that if you put the $Temp
in quotes "$Temp" it's ok
RTFM i guess
thx for your time
Re: template-indentations
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Oliver Heyden wrote:
>
> Hi,
>
> I am just new to velocity and have one question regarding templates:
>
> When I use the following template:
>
> public void test(){
> #foreach ($name in $names)
> $name.lock();
> #if ($name.isMember())
> ${name}.welcome();
> #else
> ${name}.register();
> #end
> #end
> }
>
> velocity produces correctly something like
>
> public void test(){
> Martin.lock();
> Martin.welcome();
> Susan.lock();
> Susan.welcome();
> Hans.lock();
> Hans.register();
> }
>
> My problem is, that the template does not look very clear because of the
> missing indentations before the vtl-statements.
> I'd rather use something like the following template with indentations
> before the vtl-statements in order to make the template more readable:
>
> public void test(){
> #foreach ($name in $names)
> $name.lock();
> #if ($name.isMember())
> ${name}.welcome();
> #else
> ${name}.register();
> #end
> #end
> }
>
> But then velocity writes all the indentation-spaces in the output, so
> that I get:
>
> public void test(){
> Martin.lock();
> Martin.welcome();
> Susan.lock();
> Susan.welcome();
> Hans.lock();
> Hans.register();
> }
>
> Is there any way to make indentations before vtl-statements in a
> template without velocity writing it in the output??
Right now, no. The reason is that since Velocity is a general purpose
template engine, we want to be as accurate as possible when reproducing
the non-Velocity Template Language input to the output.
This issue has been noted though. :)
> By the way, is there a mailing-archive??
http://www.mail-archive.com/velocity-dev%40jakarta.apache.org/
http://www.mail-archive.com/velocity-user%40jakarta.apache.org/
> Thank you in advance.
>
> Ciao, Olli
--
Geir Magnusson Jr. geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity
template-indentations
Posted by Oliver Heyden <5h...@informatik.uni-hamburg.de>.
Hi,
I am just new to velocity and have one question regarding templates:
When I use the following template:
public void test(){
#foreach ($name in $names)
$name.lock();
#if ($name.isMember())
${name}.welcome();
#else
${name}.register();
#end
#end
}
velocity produces correctly something like
public void test(){
Martin.lock();
Martin.welcome();
Susan.lock();
Susan.welcome();
Hans.lock();
Hans.register();
}
My problem is, that the template does not look very clear because of the
missing indentations before the vtl-statements.
I'd rather use something like the following template with indentations
before the vtl-statements in order to make the template more readable:
public void test(){
#foreach ($name in $names)
$name.lock();
#if ($name.isMember())
${name}.welcome();
#else
${name}.register();
#end
#end
}
But then velocity writes all the indentation-spaces in the output, so
that I get:
public void test(){
Martin.lock();
Martin.welcome();
Susan.lock();
Susan.welcome();
Hans.lock();
Hans.register();
}
Is there any way to make indentations before vtl-statements in a
template without velocity writing it in the output??
By the way, is there a mailing-archive??
Thank you in advance.
Ciao, Olli
Re: Velocity VTL
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Skondras Panagiotis wrote:
>
> Hi
> I would like to ask something about the Velocity
>
> I need to have a $Test.getSomething().getElse( $PrevTest.getPTest().getPTElse() )
>
> The $Prev is in the Context
Do you mean PrevTest is in the context?
> The $Test is in the Context.
> When i try the above i get nothing
> but when i do
>
> $Test.getSomething().getElse( "SomeValue" )
> I get Results can someone explain this please
Not yet, but with more information maybe...
> Also i tried
> #set ($Temp = $PrevTest.getPTest().getPTElse() )
> $Test.getSomething().getElse( $Temp )
What is in $Temp at that point?
Try the following template :
$PrevTest.getPTest().getPTElse()
#set ($Temp = $PrevTest.getPTest().getPTElse() )
my \$Temp = $Temp
$Test.getSomething().getElse( $Temp )
> I get the same no output i also put the $Temp as ${Temp}
> no luck
>
> thx in advance
--
Geir Magnusson Jr. geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity