struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: Form Bean Help?
Date Tue, 29 Jul 2003 16:55:57 GMT
Matt wrote:
> I had been using the value property of the struts-html
> tags to fill in the data, but I've noticed that when
> the user hits submit, if there is a validation error,
> they are pushed back to the page, and the data they
> had enetered is replaced with what was in the DTO
> (which is now old data).

Don't use the 'value' attribute, just let Struts render the HTML form
elements based on what's stored in the Form bean.  That will fix the
redisplay on validation problem.

If you need to pre-populate the form, read the DTO from the database and use
BeanUtils.copyProperties(...) to copy the DTO values into the Form bean
before forwarding to the view.

Take a look at the struts-example webapp, it works the way you're
describing.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message