[FreeMarker-user] Question about collections/sequences in data model
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
From: Steve S. <ss...@ti...> - 2003-04-06 17:45:00
|
What is the Java code for creating a collection or sequence and stuffing subvariables into it? I've played around with SimpleCollection and SimpleSequence and can't figure it out. The manual doesn't have an example. For example, I want to have a collection or sequence named "Districts" that have the following subvariables: Code Name Selected Then in the HTML template file, I want to use a "list" directive, such as: District <SELECT NAME="District"> <#list Districts as DistrictItem> <OPTION ${DistrictItem.Selected}>${DistrictItem.Code} - ${DistrictItem.Name}</OPTION> </#list> </SELECT> I've been able to do it OK without the subvariables, but my mind is getting bent trying to figure out the subvariable part. Examples of data wanting to load: DistrictItem.Code = "WSD" DistrictItem.Name = "Washington School District" DistrictItem.Selected = "" DistrictItem.Code = "JSD" DistrictItem.Name = "Jefferson School District" DistrictItem.Selected = "" DistrictItem.Code = "LSD" DistrictItem.Name = "Lincoln School District" DistrictItem.Selected = "SELECTED" |