You said you wanted different validation for different
methods in an action, yes?
<action name="meth1"
class="foo.FooClass"
method="method1" .../>
<action name="meth2"
class="foo.FooClass"
method="method2" .../>
FooClass-meth1-validation.xml
First set of validations
FooClass-meth2-validation.xml
Second set of validations
Perhaps I'm misunderstanding what you want to do.
Regarding annotations, AFAIK you can set the
"validateAnnotatedMethodOnly" attribute on the
validation interceptor [1] and annotate methods in
your action class as normal. Haven't done that myself,
so I don't know if it works or not.
d.
[1]
http://struts.apache.org/2.x/docs/validations-annotation.html
--- lbastil <[EMAIL PROTECTED]> wrote:
>
> Hm, but as I have model driven action,
> for both methods (even if I want to validate
> different attributes later on)
> the first I have to use is VisitorFieldValidator
> with appendPrefix=false for
> the model attribute of the action class.
>
> So at this level there is no difference, thats why I
> cannot see how it
> should help.
>
> Could you explain your suggestion a little more in
> detail?
> Would it be realizable with annotation approach too?
>
> Thank you very much in advance,
> Basti
>
>
>
> newton.dave wrote:
> >
> > Create two validation XML files, one for each
> method.
> > You can differentiate between them in a couple
> > different ways, the easiest may be to just create
> two
> > action mappings, one for each method.
> >
> > d.
> >
> > --- lbastil <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> Is there any way with the build in declarative
> >> validation possibilities in
> >> struts 2 (annotations, xml)
> >> to do something like conditional validation in
> the
> >> following sense:
> >>
> >> in the action class I have a model class, where
> on
> >> action method one i want
> >> to validate
> >> a special subset of model attributes and on
> action
> >> method two another subset
> >> of attributes?
> >>
> >> (note the model in action is used "modeldriven")
> >>
> >> Thank you for any idea,
> >> Basti
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/-s2--conditional-validation-tf4843582.html#a13857280
> >> Sent from the Struts - User mailing list archive
> at
> >> Nabble.com.
> >>
> >>
> >>
> >
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/-s2--conditional-validation-tf4843582.html#a13859839
> Sent from the Struts - User mailing list archive at
> Nabble.com.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]