You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tom Jerry <to...@gmail.com> on 2006/09/18 11:17:14 UTC

validation

is it NOT possible to use both validation.xml and ActionErrors validate ( )
??????

For eg: consider Login Form.

1) I used validation.xml to make sure that the username / password fields
are not empty.
2) I used validate ( ) to validate the values entered in the form fields

If I use either of them, output comes.

If I use both of them, no expected output comes.

That is the problem with my appln. Please help.

RE: validation

Posted by "Strachan, Paul" <Pa...@det.nsw.edu.au>.
I think just make sure any existing messages object is not replaced 
e.g.
 
ActionMessages errors = new ActionMessages();
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("my.error.key"));
saveErrors(request, errors);
...
// then later
errors = form.validate(mapping, request);   // returns a new ActionMessages object
saveErrors(request, errors);
...
 
in above case the 2nd saveErrors() call would replace the initial messages
 

________________________________

From: Tom Jerry [mailto:tom.snow.jerry@gmail.com]
Sent: Mon 18/09/2006 8:26 PM
To: Struts Users Mailing List
Subject: Re: validation



Thank you so much. It worked. btw, what did u mean "be careful to perserve
any messages" ?

On 9/18/06, Ted Husted <hu...@apache.org> wrote:
>
> Yes, but you have to call the super class's validate to fire the
> validation framework, and be careful to perserve any messages.
>
> -- HTH, Ted.
> * http://www.husted.com/struts/
>
> On 9/18/06, Tom Jerry <to...@gmail.com> wrote:
> > is it NOT possible to use both validation.xml and ActionErrors validate
> ( )
> > ??????
> >
> > For eg: consider Login Form.
> >
> > 1) I used validation.xml to make sure that the username / password
> fields
> > are not empty.
> > 2) I used validate ( ) to validate the values entered in the form fields
> >
> > If I use either of them, output comes.
> >
> > If I use both of them, no expected output comes.
> >
> > That is the problem with my appln. Please help.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

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


Re: validation

Posted by Tom Jerry <to...@gmail.com>.
Thank you so much. It worked. btw, what did u mean "be careful to perserve
any messages" ?

On 9/18/06, Ted Husted <hu...@apache.org> wrote:
>
> Yes, but you have to call the super class's validate to fire the
> validation framework, and be careful to perserve any messages.
>
> -- HTH, Ted.
> * http://www.husted.com/struts/
>
> On 9/18/06, Tom Jerry <to...@gmail.com> wrote:
> > is it NOT possible to use both validation.xml and ActionErrors validate
> ( )
> > ??????
> >
> > For eg: consider Login Form.
> >
> > 1) I used validation.xml to make sure that the username / password
> fields
> > are not empty.
> > 2) I used validate ( ) to validate the values entered in the form fields
> >
> > If I use either of them, output comes.
> >
> > If I use both of them, no expected output comes.
> >
> > That is the problem with my appln. Please help.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: validation

Posted by Ted Husted <hu...@apache.org>.
Yes, but you have to call the super class's validate to fire the
validation framework, and be careful to perserve any messages.

-- HTH, Ted.
* http://www.husted.com/struts/

On 9/18/06, Tom Jerry <to...@gmail.com> wrote:
> is it NOT possible to use both validation.xml and ActionErrors validate ( )
> ??????
>
> For eg: consider Login Form.
>
> 1) I used validation.xml to make sure that the username / password fields
> are not empty.
> 2) I used validate ( ) to validate the values entered in the form fields
>
> If I use either of them, output comes.
>
> If I use both of them, no expected output comes.
>
> That is the problem with my appln. Please help.
>
>

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