You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by CrackheadMillionaire <cr...@yahoo.com> on 2008/02/28 01:48:25 UTC

nested object on form / html:select / pre selected value in option list

Hello friends - 

I feel like I must be missing something simple, but can't see it for the life of me. 

Struts 1.3.8

I have an array of objects on my form that I need to submit values against.  So, I have a top level loop something like this:

<logic:iterate name="myFormName" propety="topLevelObject.arrayOfObjects" id="whatever" index="counter">
    
I need to build form inputs to submit properties into objects in the array.   Thus far, the only way I have been able to get this is by writing html and forcing in the index value, as opposed to struts tags; i.e., 

<select name="topLevelObject.arrayOfObjects[<%=counter%>]">
     <logic:iterate name="someOtherValueSet" id="newId">
     <option><bean:write name="newId" property="someField"/>
    </logic:iterate>
</select>

However, this doens't give me the ability to have a value preselected.  

What I cannot find a way to do is incorporate my index value into a struts html:select tag; I could then use a html:optionsCollection tag which would do the job of finding a value to preselect nicely for me.  

Any insight is greatly appreciated!

brian


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping