Hi,

What is the best way of setting a Java Collection which holds Java
Objects
as a property of the form, and retrieving the Object and it's properties

on a JSP?

I've tried it as such but have not been successful:

In my action, I have created a list called "myList" which holds objects
of type "myClass".
"myClass" has an attribute "name" and a getter method "getName". In the
action I set the list
as a property of a DynaValidatorForm:

form.set("availableNamesList", myList );

In struts-config:
 <form-bean name="newNameForm"
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="selectedName" type="java.lang.String"/>
      <form-property name="availableNamesList" type="java.util.List"/>
</form-bean>

In the JSP:
 <html:form  action="/addNewName" >
        <html:select property="selectedName" size="5"  multiple="false">

              <html:options  collection="availableNamesList"
property="name"  />
         </html:select>
</html:form>

This results in the error: [ServletException in:/jsp/newName.jsp] Cannot
find bean under name availableNamesList'

If I put the list in session scope in my action with:
request_.getSession().setAttribute("availableNamesList",  myList);
this works fine.

I'd like to avoid having to put the list in session scope and I don't
understand why just setting the list
as a property of the form doesn't work.

Any help/guidance would be appreciated.

Thanks,
SB



--
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.



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

Reply via email to