Hi,
I have gotten myself into a bit of a jam and I am wondering if someone could
help me out.
I got a web app that a customer wants to make some last minute changes to.
>From the looks of it, it looks simple but I can't figure it out. Hopefully
someone has an idea on how I can do this.
I have a vector, that holds a CategoryList object, that holds a vector of
Category Objects. Each one of these objects has the usual set/get methods:
CategoryList Object
set/get CategoryList Vector
add Category List adds a Category to the above Vector
getCategory(int i) returns the Category at that element for the above
Vector.
Category Object
set/get categoryGroup (String)
set/get categoryValue (String) ***I think this is what I need populated***
set/get categoryValues (Vector) of Strings
There can be an unknown number of category objects in the CategoryList
Object. On my page I want to create a series of Select dropdowns with the
categoryValues of each Category Object. I have managed to do this via:
<TABLE>
<logic:iterate id="category" name="CategoryList" property="categoryList"
scope="session">
<TR>
<TD>
<bean:write name="category" property="categoryGroup" />
</TD>
<TD>
<html:select name="category" property="categoryValue"
indexed="true">
<bean:define id="categoryValue" name="category"
property="categoryValues"/>
<html:options name="categoryValue" />
</html:select>
</TD>
</TR>
</logic:iterate>
</TABLE>
This creates something like:
<TR>
<TD>
Project
</TD>
<TD>
<select name="category[0].categoryValue">
<option value="Commissioning">Commissioning</option>
<option value="Commissioning,Engineering
Signoff">Commissioning,Engineering Signoff</option>
<option value="Commissioning,Government
Agencies">Commissioning,Government
Agencies</option>
<option value="Erection/Installation">Erection/Installation</option>
<option
value="Erection/Installation,Structural">Erection/Installation,Structural</o
ption>
<option value="Erection/Installation,Structural,Footings & Foundation">
</select>
</TD>
</TR>
My problem is getting the value of what the user selected. All I want to do
is for the first select box, whatever the user selected put that in the
respective categories categoryValue property. But I do not see where that
value is going. When I look at the request parameters I get:
category[0].categoryValue = Erection/Installation,Structural,Footings &
Foundation
In a nutshell is there a way to populate my objects with the value that the
user has selected? Do I need to modify my object?
Any help you can provide is highly appreciated.
Alex
pwCategory.java
pwCategoryList.java