struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barnett, Brian W." <>
Subject RE: Validator and DispatchAction
Date Wed, 18 Feb 2004 16:11:25 GMT
Set validate="false" in your action mapping in struts-config. This tells the
struts framework not to call validate. Then in your action class you can
call validate where appropriate, i.e., the *save* method.

-----Original Message-----
From: Renato Romano [] 
Sent: Wednesday, February 18, 2004 6:43 AM
To: 'Struts Users Mailing List'
Subject: Validator and DispatchAction

I'm quite new to the validator framework, and was trying to figure out
how to use it. My situation is:
1) I want to perform server side validation, and so I made my form
extend ValidatorForm;
2) the action that processes my form is a DispatchAction, so I have
methods like "edit", "save" "list", all associated with the same form;
3) I call http://blabla/myapp/ to have the
app present me with an empty form;
4) When processing this action, struts allocates the form and calls the
validate method, which of course causes validation errors to be
produced, and the request to be forwarded to the "input" element of my
action, which, as usual, is the same jsp which contains the form;
5) since the page finds some errors (the form is empty!!) they are shown
by the <html:errors/> tag.

The only think I can imagine is to have a separate action in
struts-config, which takes no form and simply redirects control to the
jsp page which shows the (html) form. This should avoid Struts from
calling the validate method, and hence <html:errors/> should show

Of course this would change a bit the logic we already placed in the
application actions: for example in our
architecture should present an empty form, while
should fill the form with the properties of the object with id 88, and
then forward to the same jsp page, which then shows that object ready to
be modified. If my above consideration is correct I should define two
separate actions in struts-config, and let the links be something like (for the presentation of an empty form) and unchanged for
the "loading" of an object.

Is all this correct ?Are there alternative approaches? Should I quit
server side validation and only use client-side (which does not suffer
from this problem)?
Any help is very appreciated.


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

Tel.:   010 2712603

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

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

View raw message