[stringtemplate-interest] selecting a dropdown option

Nate misc at n4te.com
Tue May 15 15:59:22 PDT 2007


I have a template similar to this where I want to select one of the 
locations...

<select name="location">
$locations:{location|
    <option $if(location.name == 
selectedLocation)$selected$endif$>$location.name$</option>
}$
</select>

Obviously that isn't valid ST and would break separation. The location 
objects are part of an object model I don't have access to, otherwise I 
could add an "isSelected" method and use a template like this...

<select name="location">
$locations:{location|
    <option $if(location.selected)$selected$endif$>$location.name$</option>
}$
</select>

Is there any other way than to wrap the location objects in my own class 
and have a whole slew of delegate methods? This is a common scenario in 
my webapp.

-Nate



More information about the stringtemplate-interest mailing list