Christopher Becker wrote:
Another issue - I wish to allow users to modify content to records
saved to the database, by loading up the same (or identical ) form
referenced below with a saved record and allow for modifications. I do
this in an action which retrieves the record from the datastore, saving
the record in a request attribute, and displaying the values in the form
by setting the value attribute of the <html:input> tags as follows:
<html:text property="name" value="${modrecord.name}"/>
The data displays correctly, but when making modifications and passing
the result thru validation, when validation fails for any reason the
data in the input fields disappear.
Is there a (better) way to present data in a form for modification,
allow updates and to have validation work without clearing the input
fields?
The problem here is that your initial values are coming from an object
other than the form bean. When the form is submitted, Struts populates
the form bean with the submitted values. Your modrecord object isn't
updated, though, so when the form is redisplayed, it is displayed with
the original data.
The fix for that is, instead of putting the modrecord object in the
request and referencing it in your form tags, copy the data from
modrecord into the form bean before forwarding to the JSP. Then, in the
JSP, remove the value='' attributes from your input tags.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]