Because you've specified the "collection" attribute, it's trying to find 
a bean reference under that name specified. Because it has to be a 
reference to a collection itself, it can't be changed to a nested property.

So, expose a bean to the name using the nested:define, in the collection 
attribute, and you should get that bean reference to use the original 
<html:options> tag.
Example...

<nested:iterate property="itemList">
    <nested:define id="defBean" property="myOptionsCollectionProperty" />
    <nested:select property="userId">
        <html:options collection="defBean" property="idValue" 
labelProperty="displayValue" />
    </nested:select>
</nested:iterate>

The simplified nested version, is when you just use the property 
attribute to get a list if objects, that will render their string form. 
Not all that handy when you want to specify the different label and value.

The best solution is in the nightly builds or 1.1 Beta. Use the new 
<nested:optionsCollection> tag that extends the new 
<html:optionsCollection> tag. This is pretty much what you're wanting 
actually. Set the property attribute to the bean property that is a 
collection of beans (that you have), and then set the label and value 
attributes to point to the various bean properties.

So, just replace your <nested:options> line with...
<nested:optionsCollection property="userList" label="displayValue" 
value="idValue" />


Either one of these above will get things happening.


Arron.


Elijah Jacobs wrote:

>Hi all,
>
>some code would help:
>
><nested:form ....>
>    <nested:iterate property="itemList">
>           <nested:text property="name"/>
>           <nested:select property="UserId">
>                <nested:options collection="userList" property="idValue"
>labelProperty="displayValue"/>
>           </nested:select>
>    </nested:iterate>
></nested:form>
>
>As you can see I have a form that has a reference to an ArrayList "itemList"
>and each item on this list has an ArrayList "userList" that holds idValue
>and displayValue attributes.
>
>Currently I am getting to my JSP through an action class.  The code above
>gives me a NullPointerException. And I figured out that it complains,  not
>because userList is empty, but because of property="idValue"
>labelProperty="displayValue". In fact I can do this:
>   <nested:iterate property="userList">
>        Stuff
>   </nested:iterate>
>
>and the word "Stuff" will be printed out.  So you might think it's because
>the attribute idValue and displayValue are null.
>
>Well, when I put the userList on the request attribute and do this: (where
>"things" is my userList)
>  <jsp:useBean id="things" type="java.util.ArrayList" scope="request"/>
>      <logic:iterate id="all" type="...." collection="<%=things%>">
>         <bean:write name="all" property="idValue"/>
>        <bean:write name="all" property="displayValue"/>
>  </logic:iterate>
>
>the displayValue and idValue is printed out fine.
>
>I was wondering why  <nested:options> was not able to pick up the proper
>idValue and displayValue? Can some point me to the direction as to how to go
>about solving this? thanks.
>
>Your time is appreciated,
>
>- ej
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to