struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith <>
Subject RE: ActionForm Defaults/Updates Question
Date Fri, 15 Feb 2002 13:26:48 GMT
I don't use validate(). The only validation I have is in the business logic.
The business class that does validation accepts & returns a string version of
the data (as well as the proper data type).
validate() introduces a new element of execution flow into the design
(validation occurs in 2 diff. layers of the app), is a wee bit problematic &
can be lived without.
(my opinion - but I like to keep things baby simple).

--- Ronald Haring <> wrote:
> > That's what I do to.
> > Putting initialisation logic (like setting defaults) in the 
> > form makes it a
> > very strange object. Partly a Utility for passing data 
> > between Forms & Action
> > classes & partly a controller fetching data from the model to make it
> > accessible to the JSP. The second part there is the job of 
> > the Action class.
> > Keep Form Beans Clean!
> Ok, but how do you handle generated errors.
> If the validate finds an error in an input field, it will display the form
> again, without going through any action.
> So how can you set the setted variables back again to their states. I
> encountered this when I was using a list with values from a database passed
> on the parameter a user passed in combination with an input form. 
> If the validate encountered an error, I got a no collection found.
> I solved this by saving the formbean in the session and if validate
> generated errors I retrieved the formbean from the session again in a temp
> bean and copied the list values from the previous bean back in the new one.
> Gr
> Ronald
> Furore B.V.
> Rijswijkstraat 175-8
> Postbus 9204
> 1006 AE Amsterdam
> tel. (020) 346 71 71
> fax. (020) 346 71 77
> ----------------------------------------------------------------------------
> ---------------
> The information transmitted is intended only for the person
> or entity to which it is addressed and may contain confidential
> and/or privileged material. Any review, retransmission,
> dissemination or other use of, or taking of any action in
> reliance upon, this information by persons or entities other
> than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material
> from any computer
> ----------------------------------------------------------------------------
> ---------------

Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message