You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Slattery, Tim - BLS" <Sl...@bls.gov> on 2004/06/15 20:34:13 UTC

RE: How to fill the html:text with values and data from the actio n form

> I have forms that insert and modify objects.
 
> When I modify an object I need that the form be filled with 
> the object information. 
 
> <html:text property="name" value="${object.name}"/>

The "value" attribute is not necessary here. The Struts framework will
retrieve the value of the "name" property from the form bean and populate
your form with it.

> After is filled if the user changes something, submits the 
> form and there is a validation error I would like to mantain 
> the values the user changed that are stored in the action 
> form. How can I do this?

The values that the user put into your form have been collected by the
framework and put into a copy of the form bean, and that bean has been
supplied to your Action function. All you need to do is to retrieve it,
store it in the request object, create a list of errors and store it with
saveErrors(), then return mapping.getInputForward(). The framework will
access the bean you stored - which is the bean containing the data the user
submitted - and use that to populate the fields in the page that's being
reshown with error messages.

--
Tim Slattery
Slattery_T@bls.gov


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org