You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Grobe <ga...@grobe.net> on 2004/08/23 00:33:39 UTC

velocity conditionals

Hey all,

Does the velocity conditional mean that any lines between the #if and 
#elseif are included or does it just accept one line as shown in the 
docs? In other words, is the following supposed to work?

#if ($selection == "sel1")
	html_statement1_output1
	html_statement2_output2
	html_statement3_output3
#elseif ($selection == "sel2")
	html_statement1_output1
	html_statement2_output2
	html_statement3_output3
#end


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: velocity conditionals

Posted by Shinobu Kawai <sh...@ieee.org>.
Hi Grobe,

> Does the velocity conditional mean that any lines between the #if and 
> #elseif are included or does it just accept one line as shown in the 
> docs? In other words, is the following supposed to work?

> #if ($selection == "sel1")
> 	html_statement1_output1
> 	html_statement2_output2
> 	html_statement3_output3
> #elseif ($selection == "sel2")
> 	html_statement1_output1
> 	html_statement2_output2
> 	html_statement3_output3
> #end

I am not sure about what you are trying to ask, but it would show
    html_statement1_output1
    html_statement2_output2
    html_statement3_output3
or
    html_statement1_output1
    html_statement2_output2
    html_statement3_output3
or nothing.  (Hey, they're both the same!)

By "work", what do you mean?  How do you intend it to show, and how does
it actually show?  (ie. Why do you ask?)

And which doc are you referring to?  Mine says "The content between the
#if and the #end statements become the output if the evaluation is true."
    cf. http://jakarta.apache.org/velocity/user-guide.html#Conditionals


Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org