Hi Alex,

I believe your problem is that the CategoryList object is in the session, rather
than in your form bean.  I think that struts will be fine with this to *display*
the information, but to update it, you need it in your form bean - as far as I
can tell, struts only populates stuff in the ActionServlet's processPopulate()
method, which only populates the associated formbean (though I could be missing
something).

Is it possible for you to grab it in your action and put a copy in your
formbean?

hope that helps,

Dave





"Alex Colic" <[EMAIL PROTECTED]> on 10/18/2001
11:17:30 AM

To:   "David_Hay/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Quick Iterator/indexed question, please.



Sorry to bug you directly. I just got into a bit of a jam and I am wondering
if you could help me out.

I got a web app that a customer wants to make some last minute changes to. I
posted on the Struts list but no bites so far and the deadline is
approaching. I am sure it is something simple I am just missing something.
If you have a moment could you send me in the right direction?


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

Reply via email to