FW: [Opensource] Is the use of DefaultForm a common/best prac
tice on Expresso projects?
Mike Traum
mtraum at cirnetwork.org
Thu Apr 3 14:23:29 PST 2003
Same here - I'm not using ActionForm validation, but find ActionForms nice
for storing session information in a clean way over a wizard-style
controller. You can do this directly with sessions, but it tends to be
unruly if you have a fair amount form fields. I think of an ActionForm as a
contract between my view and model.
Regarding validation(), what you describe follows struts docs at
http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html#form
_validation
<http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html#for
m_validation> . It seems that it calls validate(ActionMapping mapping,
HttpServletRequest request);, so my guess would be that you would want a
switch() on the ActionMapping to handle validation of different states.
btw, ActionForms lie somewhere between the View and Model. Because of this,
it is not recommended that any business logic validation be done there, but
only simple regex-type validation.
mike
-----Original Message-----
From: Michael Rimov [mailto:rimovm at centercomp.com]
Sent: Thursday, April 03, 2003 2:14 PM
To: opensource at jcorporate.com
Subject: Re: FW: [Opensource] Is the use of DefaultForm a common/best
practice on Expresso projects?
At 08:11 AM 4/3/2003 -0700, you wrote:
First off, if you use ActionForms do you utilize the validate method? If
you how? Do you have a Controller with one state and one form much like how
Struts works? What I found is that if you create your own form and assign
it in the struts-config.xml file the minute the initial state is called that
form's validate method is called (actually it is called before the
controller is called) Which that kind of breaks the ability to have a
Controller with multiple states. And if you don't utilize the ActionForm's
validate method then why are you creating a ActionForm? What functionality
are you gaining?
Actually, for me, I found it incredibly convenient for multiple page forms.
One app, I had an "OrderInfoBean", and I split the data entry into multiple
pages, one for shipping, one for credit card info. etc.... then once I had
all the information, I processed the whole bean. Saved a lot of typing for
populating the bean from raw parameters.
Peter Pilgrim used a custom Action form to store search results in the
session to provide a caching mechanism for searches.
Neither of these used the validate() function.
HTH!
-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030403/fe289984/attachment-0002.htm
More information about the Opensource
mailing list