Regarding:

2011/12/1 Josep García <jgar...@isigma.es>

>
> In order to validate dynamic form input fields (based on freemarker's
> ability to render input fields from xml tree), I've also had to code my own
> field validator, because my action does not have getter/setter for the
> dynamic fields.
>
> In my derived XmlRequiredFieldValidator, I reimplement getFieldValue:
>
>     protected Object getFieldValue(String name, Object object) throws
> ValidationException {
>         ValidateableXml action = (ValidateableXml) object;
>         Map<String, String[]> params = action.getParameterMap();
>         String[] val = params.get(name);
>         String str = null;
>         if (val != null) {
>             str = val[0];
>             if (str.isEmpty()) {
>                 str = null;
>             }
>         }
>         return str;
>     }
>
> I fear I'll probably have to rewrite xml*fieldvalidator for other
> validator types.
>
> If you can think of a better alternative, let me know.
>

The validation requires getters/setters on the action, and does not pickup
values from submitted input form params. Am I right?
Maybe, the ValueStack should also contain submitted params.

Cheers,
Josep

Reply via email to