Christopher Schultz wrote:
> Philippe,
> 
> Pille wrote:
>>>> how can i set a property of a dyna form from within an action?
>>> That's easy: just do the same thing you do in your SaveAction to get a
>>> reference to the form bean. Then, instead of just calling accessors to
>>> get the data our, call mutators to put data in. But, if you are talking
>>> about accepting data from the form for re-display, why not just make it
>>> part of the form and have Struts do that work for you?
>> can you get more in detail please? ;)
> 
> I'm suggesting that, instead of writing code in your action to call
> request.getParameter("myFormStuff") and then poking it into the
> DynaValidatorBean, you add the appropriate fields to your dynamic bean
> (in struts-config.xml) so that Struts will populate (and validate!) your
> form bean for you.
> 
>>> Whenever I need parameters to be forwarded across multiple actions, I
>>> either put them in the form bean or do it manually by using hidden form
>>> elements, pulling their values out in my submission handling actions,
>>> and then put them back into the URLs of my redirect actions.
>> i had the ArrayList as property of a DynaActionForm. when i submitted
>> the form the Bean wasn´t set anymore.
> 
> How were you trying to submit the data that was supposed to go into that
> arraylist? Typically, one uses a special syntax for submitting indexed
> information by using form field names such as "salary[1]" -- not the use
> of the square-brackets and an explicit numeric index.

i iterate over the arraylist in a c:forEach loop. there i set the
properties of the arraylist like this:

<c:forEach var="currentp" items="${buyOnlineForm.chosenProducts}"
varStatus="itemStatus">

         <html:select name="currentp" property="product" indexed="true"
style='width: 100px;'>
           <html:options name="currentp" property="productSelectionOptions"/>
         </html:select>
....
</c:forEach>

where chosenProducts is an array list with beans. the bean has the
property product. you can see that the html:select tag is indexed. so i
can iterate dynamically with regexp over all the parameters passed on
submit.



> 
>> but there is another thing i´ve been thinking of. earlier i had my own
>> DynaActionForm class and i have set some properties in the
>> struts-config.xml. the ArrayList (which holds the beans) was set as a
>> property in my own class because i didn´t know how to access the getters
>> and setters of a DynaActionForm. the form tag in struts-config.xml was a
>> type of my own DynaActionForm extension. Is it ok to mix it like this or
>> do i either have to implement every property in a own DynaActionForm
>> class or do i have to declare everything in struts-config?

sorry, i meant "implement in a ActionForm class".

> 
> I would recommend that, if you are going to use DynaValidatorForm, you
> just use it as-is instead of subclassing it.

ok.

> 
> -chris

thank you

philippe

---------------------------------------------------------------------
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