You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thilo Ettelt <te...@carmunity.de> on 2007/12/04 13:01:15 UTC
[s2] Different Annotated Validations for different action methods
Hey all,
I'm trying to figure out how to validate my action methods differently.
For example I've got a modeldriven User bean with the following two
annotated methods
@Validations(...)
- processLogin
@Validations(...)
- processSignup
Now I want the first annotation to only check for the username and
password, but the second annotation is supposed to check for other
things like email too.
However when I call the appropriate action mapping which calls
processSignup it processes both Validations, which results in a
invalid email address error for the login in addition to the wrong
username and password.
So how can I separate the two validatio annotations without needing
separate classes?
- Thilo
--
Mit freundlichen Grüßen,
Thilo Ettelt Telefon: +49-421-6265-111
Carmunity.com GmbH Telefax: +49-421-6265-100
Mary-Astell-Strasse 2 E-Mail: te@carmunity.de
28359 Bremen http://www.carmunity.de/
Developer (YourVids)
Handelsregisternummer: HRB 19256 beim AG Bremen
Geschäftsführer:
Dipl.-Wirt.-Ing. W. Schlösser
Dipl-Ing. Frank Rothgänger
Bennet Bock
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Different Annotated Validations for different action methods
Posted by Thilo Ettelt <te...@carmunity.de>.
It seems to me I've found the solution:
Add this to your action declaration:
<interceptor-ref name="defaultStack">
<param name="validation.validateAnnotatedMethodOnly">true</param>
<param name="includeMethods">actionMethodHere</param>
</interceptor-ref>
Have fun! :)
- Thilo
This works for me, but
Am 04.12.2007 um 13:24 schrieb Martin Gilday:
> I posted about this a while back. Nobody seemed to have an annotation
> based solution, only going back to XML.
>
>
> ----- Original message -----
> From: "Thilo Ettelt" <te...@carmunity.de>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Tue, 4 Dec 2007 13:01:15 +0100
> Subject: [s2] Different Annotated Validations for different action
> methods
>
> Hey all,
>
> I'm trying to figure out how to validate my action methods
> differently.
>
> For example I've got a modeldriven User bean with the following two
> annotated methods
>
> @Validations(...)
> - processLogin
>
> @Validations(...)
> - processSignup
>
>
>
> Now I want the first annotation to only check for the username and
> password, but the second annotation is supposed to check for other
> things like email too.
>
> However when I call the appropriate action mapping which calls
> processSignup it processes both Validations, which results in a
> invalid email address error for the login in addition to the wrong
> username and password.
>
> So how can I separate the two validatio annotations without needing
> separate classes?
>
>
> - Thilo
>
> --
> Mit freundlichen Grüßen,
>
> Thilo Ettelt Telefon: +49-421-6265-111
> Carmunity.com GmbH Telefax: +49-421-6265-100
> Mary-Astell-Strasse 2 E-Mail: te@carmunity.de
> 28359 Bremen http://www.carmunity.de/
>
> Developer (YourVids)
>
> Handelsregisternummer: HRB 19256 beim AG Bremen
> Geschäftsführer:
> Dipl.-Wirt.-Ing. W. Schlösser
> Dipl-Ing. Frank Rothgänger
> Bennet Bock
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Mit freundlichen Grüßen,
Thilo Ettelt Telefon: +49-421-6265-111
Carmunity.com GmbH Telefax: +49-421-6265-100
Mary-Astell-Strasse 2 E-Mail: te@carmunity.de
28359 Bremen http://www.carmunity.de/
Developer (YourVids)
Handelsregisternummer: HRB 19256 beim AG Bremen
Geschäftsführer:
Dipl.-Wirt.-Ing. W. Schlösser
Dipl-Ing. Frank Rothgänger
Bennet Bock
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Different Annotated Validations for different action methods
Posted by Martin Gilday <ma...@imap.cc>.
I posted about this a while back. Nobody seemed to have an annotation
based solution, only going back to XML.
----- Original message -----
From: "Thilo Ettelt" <te...@carmunity.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Tue, 4 Dec 2007 13:01:15 +0100
Subject: [s2] Different Annotated Validations for different action
methods
Hey all,
I'm trying to figure out how to validate my action methods differently.
For example I've got a modeldriven User bean with the following two
annotated methods
@Validations(...)
- processLogin
@Validations(...)
- processSignup
Now I want the first annotation to only check for the username and
password, but the second annotation is supposed to check for other
things like email too.
However when I call the appropriate action mapping which calls
processSignup it processes both Validations, which results in a
invalid email address error for the login in addition to the wrong
username and password.
So how can I separate the two validatio annotations without needing
separate classes?
- Thilo
--
Mit freundlichen Grüßen,
Thilo Ettelt Telefon: +49-421-6265-111
Carmunity.com GmbH Telefax: +49-421-6265-100
Mary-Astell-Strasse 2 E-Mail: te@carmunity.de
28359 Bremen http://www.carmunity.de/
Developer (YourVids)
Handelsregisternummer: HRB 19256 beim AG Bremen
Geschäftsführer:
Dipl.-Wirt.-Ing. W. Schlösser
Dipl-Ing. Frank Rothgänger
Bennet Bock
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org