struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <paul.mccull...@axiossystems.com>
Subject RE: Validating fields only in some situations question....
Date Wed, 30 Jul 2003 15:45:48 GMT
I asked pretty much the same question a few hours ago. Heres the answer I
got...


Not sure if anybody answered you question or not yet but there are a couple
things you can do...

1. Have many action mappings to one DispatchAction.  
<action path="/a" parameter="subtask" type="my.Dispatch" ...> ... </action>
<action path="/b" parameter="subtask" type="my.Dispatch" ...> ... </action>

link to each as "/a.do?subtask=method1" and "/b.do?subtask=method2" and then
do validation per action and not per form.

The other alternative suggested by Robert Taylor, which, once set up, is
pretty slick but involves a little extension to how validator works:
http://marc.theaimsgroup.com/?t=105352600600007&r=1&w=2





-----Original Message-----
From: Paul McCulloch [mailto:paul.mcculloch@axiossystems.com] 
Sent: Wednesday, July 30, 2003 7:59 AM
To: 'Struts Users Mailing List'
Subject: DispatchActions - using form validation for only some methods

Hi,

I've just moved to using dispatch actions from my own implementation of
something similair to relay actions. One facility my implementation gave me
was to have the form validated when some actions were called, and not
validated for other actions (at the expense of a bloated struts-config.xml).

Using dispatch actions I am now explicitly calling the form's validation for
those methods that require a validated form:

        ActionErrors errors = form.validate(mapping, request);
         if(!errors.isEmpty()) {
             saveErrors(request, errors);
             return new ActionForward(mapping.getInput());
        }

Is there a better way of achieving this?

thanks,

Paul

-----Original Message-----
From: Todor Sergueev Petkov [mailto:t.s.petkov@basalmed.uio.no]
Sent: 30 July 2003 16:37
To: Struts Users Mailing List
Subject: Validating fields only in some situations question....


Hello, I have a question :

I am using Validator framework with Struts. I have a login form on my
web page which is associated
with 3 buttons - Login, to log the user in
		 Reset , to reset the form fields
		 Register, which brings the user to a new registration page

I use only one Action of the type DispatchAction which determines what
exactly to do.

My question is : how can I tell the Validator framework to perform
validation only when the user presses the Login button
and to ignore the vallidation when the users presses any of the two
other buttons ?

Thanks,
		Todor

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


**************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not the addressee
indicated in this message (or responsible for delivery of the message to such person), you
may not copy or deliver this message to anyone. In such case, you should destroy this message,
and notify us immediately. If you or your employer does not consent to Internet email messages
of this kind, please advise us immediately. Opinions, conclusions and other information expressed
in this message are not given or endorsed by my Company or employer unless otherwise indicated
by an authorised representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via
electronic mail attachments we cannot guarantee that attachments do not contain computer virus
code.  You are therefore strongly advised to undertake anti virus checks prior to accessing
the attachment to this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for loss or damage
howsoever caused.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message