-----Original Message-----
From: Jim Barrows [mailto:[EMAIL PROTECTED] 
Sent: 12. elokuuta 2004 18:48
To: Struts Users Mailing List
Subject: RE: Indexed properties and DynaActionForm



> -----Original Message-----
> From: Jaakko Rytinki [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 12, 2004 3:05 AM
> To: 'Struts Users Mailing List'
> Subject: Indexed properties and DynaActionForm
> 
> 
> Could someone explain why the following does not work:
> 
> - - - - Form bean:
> <form-bean name="forms.myForm"
> type="org.apache.struts.validator.DynaActionForm">
> <form-property name="values" type="java.util.List" />
> </form-bean>
> 

Small typo there, I tried to use ArrayList instead of List.


> - - - - Action Mapping:
> <action path="/populateMyForm"
>               type="test.populateFormAction" 
>               scope="request">
>               <forward name="success" path="myTestPage.jsp"/>
> </action>

If you are populating here, and do not have the form specified, then how
is the form getting sent to the page?
I typically set the name parameter, and validate=false when going
through my populate actions.

- - 

By using HttpServletRequest.setAttribute("myStringList",
dataObjectArray); name-attribute, as far as I know, defines the form
where we want to read the data, it's not necessary in actions where you
just throw some stuff to request.


> 
> <action path="/readMyForm"
>               type="test.editFormAction" 
>               scope="request"
>               name="forms.myForm"
>               <forward name="success" path="myResultPage.jsp" />
> </action>
> 
> - - - - Prepopulated form:
> <logic:iterate id="value" name="myStringList">
>       <html:text property="values" value="${value}" indexed="true" />
> </logic:iterate>
> 
> - - - - Action:
> DynaActionForm dynaForm = (DynaActionForm) myForm;
> List myList = (List) dynaForm.get("values");
> 
> The form shows up fine, but somehow the List I retrieve 
> doesn't contain
> any elements. ( If the text field is empty, List should still 
> contain at
> least one element )
> 
> Only workaround I've found so far is to set size-parameter to 
> form-bean
> definition ( and because the form can contain 0 to n items, it is kind
> of a nasty way to do it, setting the size parameter high 
> enough so that
> overflow wont happen )
> 
> So.. how to use DynaActionForm to retrieve indexed properties from
> dynamically created form?
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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




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

Reply via email to