[ 
http://issues.apache.org/struts/browse/SHALE-303?page=comments#action_38326 ] 
            
Gary VanMatre commented on SHALE-303:
-------------------------------------

>1.  s:validatorVar doesn't work in Facelets.

The validatorVar JSP tag is similar to the JSF RI f:attributes and 
f:loadBundle.  These are only JSP tags and do not have a backing component.  

The s:validatorVar tag is to the s:commonsValidator as the f:attribute is to a 
component.  The commonsValidator has a Map that is called "vars" that contains 
properties you might need in a custom validation rule.  The s:validatorVar tag 
populates this collection without having to define additional attributes for 
custom validation rules.  Components have an attributes collection that 
provides attribute transparency.  The "vars" Map is a much simpler structure 
but conceptually the same.

Clay provides native support for validatorVar but you can register custom 
handlers.  I suspect that Facelets provides a similar mechanism for handling 
these tags that are not components.

> 2. I tried the minlength and maxlength validators like this

There is inconsistency between the CommonsValidator JSP tag properties and the 
validator properties.  The TLD defines these properties as "minlength" and 
"maxlength" but they are camel case on the validator "minLength", "maxLength".  

I agree that these should be made consistent but please verify that 
minLength="5" works.

<s:commonsValidator type="minlength" 
                          arg="#{label}" 
                          server="true" 
                          client="true" 
                          minLength="5"/> 


> minlength and maxlengh validators not working
> ---------------------------------------------
>
>                 Key: SHALE-303
>                 URL: http://issues.apache.org/struts/browse/SHALE-303
>             Project: Shale
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.3
>         Environment: Java 1.5.0_08
>            Reporter: Paweł Walkiewicz
>
> i'am using shale validators with facelets (ver 1.1.11) and they do not work 
> as expected..
> 1. http://shale.apache.org/features-commons-validator.html says that for a 
> mask validator i should put 
> <s:validatorVar name="mask" value="[4-6].*"/> in my code..
> this doesn't work.. I figured out tha it works only if I put mask attribute 
> into commonsValidator  element like this:
>         <s:commonsValidator type="mask"
>                           arg="#{label}"
>                           server="true"
>                           client="true"
>                           mask="[4-6].*">
> 2. I tried the minlength and maxlength validators like this:
>         <s:commonsValidator type="minlength"
>                           arg="#{label}"
>                           server="true"
>                           client="true"
>                           minlength="5"/>
> It doesn't work.. CommonsValidator throws NullPointerException from convert 
> method at line:
> String source = converterHelper.asString(context, obj.getClass(), obj);
> After some debugging I figured out that attributes minlength and maxlength 
> are not set in validator (only these because arg, min, max and mask are set).
> I found that they are not set because of the wrong names of the setting 
> methods...
> renaming methods setMaxLength and setMinLength to setMaxlength and 
> setMinlength resolves the problem..
> please fix it or correct me if I'm wrong..

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to