The point of having extensible, open-ended interceptor and configuration
mechanisms is precisely so we *can* extend it to meet application needs,
without having to modify the framework itself.
The framework provides the hooks, through interceptors and plugins,
precisely for circumstances unforesee
Yes, of course you are right.
But what you talking about sounds like to change S2 mechanism itself,
which we can not do.
As a S2 user but not a S2 developer, the simplest way is to write a
new validator..
Of course, If the [pre-condition based validation] is a common
request, I think it will
If the need is across the application, then modifying the app-wide
interceptor makes sense.
App-wide rule-based validations require something higher-level than
reworking existing validators, or writing new ones, to express something
that is likely declarative in nature. Seems more like "run this b
Changing the [validation interceptor] will switch on/off the all
validations by one pre-condition.
But what he need is:
if and only if pre-condition-A is true, run validation-A;
if and only if pre-condition-B is true, run validation-B;
etc...
So, I think the right way is, change the validators.
If the goal is to execute validations based on arbitrary preconditions (I
missed the original req) the *easiest* thing to do might be to just
extend/usurp the existing validation interceptor to do that precondition
check.
d.
On Mon, Nov 28, 2011 at 7:58 PM, Li Ying wrote:
> Looks like you want
Looks like you want some pre-condition check before the validation.
If and only if the pre-condition is true, the validation will be executed.
I did the same thing several years ago.
There are 2 solution I tried:
(A)Inherit all the struts2 bundled validators, add some pre-condition
check code,
if
Thanks Li Ying,
I got some information from
http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html?page=3#custom-validators
but I do not want to reinvent the wheel (basically avoid coding my
validation logic in java code). If I
could have my -validation.xml structured as
*
*
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.or
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
9 matches
Mail list logo