If your validate rules are fixed, only some parameters (integer/date
format or something else) relies on the country setting, I suggest you
implement it by retrieve the params via OGNL expression.

The parameter for the Validators can be OGNL expression.
These docs may help:
http://struts.apache.org/2.x/docs/ognl.html
http://commons.apache.org/ognl/language-guide.html


If your validate rules are variable, you can implement your own
Validator, and register it into struts2.
Then, you can use it in the same way as you use the "Bundled Validators".

This documents may help:
http://struts.apache.org/2.x/docs/validation.html#Validation-RegisteringValidators

To learn how to write a validator, you can read the source code of
Struts2/xWork,  in package
[com.opensymphony.xwork2.validator.validators]

And you can find some samples via google.


2011/11/28 Jyothrilinga Rao <jyoth...@gmail.com>:
> Hi all,
>
> I am currently making use of the validator and able to work-out a example
> as discussed at http://struts.apache.org/2.x/docs/validation.html.
>
> My application has a concept of user's country which is stored in session.
> Now depending on the value of this attribute stored in session, I need to
> have different validation rules for the same form and action. I would still
> like to define validations outside of my action and JSP in a XML file.
> Is there something out of box provided which can fulfill my requirement ?
> or is there something I can extend on to fulfill this ?
>
> Thanks,
> JK.
>

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

Reply via email to