Not quite.. hang on.
On 25 Jun 2004, at 00:14, Mark Lowe wrote:
A question came up the other week/month where someone nesting 2 deep
and was trying to use a 2 dimesional array. I had the some problem
today and had my chance to combine indexed and mapped properties to
solve the problem.
I want to create a Restaurant Menu editor. So a menu has a few
properties like title and start and end dates for seasonal menus.
So I have 3 action form or nested pojo's
MenuForm
CourseForm
DishBean
I used lazyMap and lazyList to save scoping to session.
MenuForm - has a lazyList or nested courses.
CourseForm - has a lazyMap of dishes and a getKeys() method that
returns map.keySet().toArray()
and dishes are just plain string properties.
public DishBean getDish(String key)
public void setDish(String key,DishBean dish)
The jsp stuff looks something like this.
<html:text property="title" />
<c:forEach var="course" items="${menuForm.courses}">
<html:text name="course" property="title" indexed="true" />
<c:forEach var="key" items="${course.keys}">
<html:text name="course" property="dish(${key}).name" indexed="true"
/>
</c:forEach>
</c:forEach>
its not quite as tidy as 2 dimensional array support, but it pretty
clean looking.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]