Thanks for the tip, Łukasz.

I have tried this option, not without a few workarounds: I had to add a
param to struts.xml so validation files are loaded during runtime:
    <constant name="struts.configuration.xml.reload" value="true"/>


I have arrived to a leve in which I can call, from my Action:

            validatorManager.validate(this, "my-validation");

and this tries to validate the form against a MyAction-my-validation.xml
file with the validation rules.
So far, so good.
However, my form post the user input as form parameters of the type:
"dom.myparam1", "dom.myparam2", etc.
Within the validation process, the validator calls OgnlContext.get(Object
key) to retrieve the value to validate agains a validation rule, but fails
to retrieve it.
While debugging, I can see the params are there in a map entry: Key:
"com.opensymphony.xwork2.ActionContext.parameters", and in value: all my
form params.
buut it fails to get the value.

Any possible workaround for this? Can I make OgnlContext look into the
ActionContext.parameters map? Or should I add programatically my dynamic
fields to the Ognl Context? Is that possible? How?

Cheers,
Josep

2011/11/18 Łukasz Lenart <lukasz.len...@googlemail.com>

> You can try to obtain ActionValidatorManager instance (@Inject in to
> an action) and try to use one of its methods.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
>
> 2011/11/16 Josep García <jgar...@isigma.es>:
> > Is there any documentation on how to call xwork validation
> programatically?
> >
> > The context: I have a dynamic form, which is a freemarker template, which
> > can have any fields that are then saved as xml in my Struts action.
> > I would like to have the possibility to call validation with a specific
> > *-validation.xml, defined at runtime, associated to the freemarker
> > template, so that I can apply xml defined validators against my action
> > context value stack. Is that possible?
> >
> > Cheers,
> > Josep
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to