File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with html:select and iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with html:select and iterate" Watch "Problem with html:select and iterate" New topic

Problem with html:select and iterate

Gigi Kent
Ranch Hand

Joined: Nov 30, 2004
Posts: 40
I have a problem and I don't know how to solve it. For about 2 day I'm working onand no results so far.
Here is:

<logic:iterate id="Item" name="iterate" >
<html:select indexed="false" name="Item" property="itemNom">
<html ptions collection="point" property="idmodule" labelProperty="module" />
So I have several selects with a name someting like item[0].itemNom; item[1].itemNom etc, so every one hasa a differeny name.
So far, everything is wotking but it keeps reseting to the first option after going through the action though.
Can anyone give me an idea? Please !!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I don't see how this could work unless you set indexed="true" in your html:select tag.

The next question I'd ask is: Does your ActionForm match this structure? Specifically: Do you have an indexed getter for the item attribute? You might want to show us the code for your ActionForm.

Consultant, Sima Solutions
Gigi Kent
Ranch Hand

Joined: Nov 30, 2004
Posts: 40
I have iterated="true"
My ActionForm is a DynaValidatorForm.
Gigi Kent
Ranch Hand

Joined: Nov 30, 2004
Posts: 40
I don't know how to do a indexed getter. Can you give me a sample?
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
"Cornel Cc",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.
I agree. Here's the link:
subject: Problem with html:select and iterate
It's not a secret anymore!