velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Esposito" <>
Subject VTL syntax, again, again
Date Mon, 05 Mar 2001 21:51:56 GMT
Ok, i think there is some sort of b** happening here, but I wanted to see if
this rings a bell before I use the bad B word ... ;)

#foreach($state in $state_list)
	$state.Name blah blah blah $state.ID
	#if($state.ID == $selected_state_id)selected#end

it seems that if selected_state_id is not defined in the context, the whole
processing of the page ends ... Velocity just up and decides to go home for
the evening ... no warnings, no error messages ... ;) ...

If I remove the #if statement, the loop runs fine ... if I put a #set
directive before the loop and define $selected_state_id like

#set($selected_state_id = 4)

the loop runs fine ...

if I compare two undefined variables,

#if($never_heard_of_you == $ghost_variable)selected#end

the loop runs fine ...

it seems like it's a problem comparing the iterator of the loop with an
undefined value causes velocity to get angry and shut down the processing of
the page ...

Nothing shows up in my velocity.log so I'm mystified as to why the template
stops getting parsed as soon as the #if statement tries to run ...


View raw message