I'm having trouble with a custom validation rule.  This used to work,
before we had <s:validatorVar> and before the switch to
commons-validator 1.3.0.  (Not that either of those changes is
necessarily the cause of this problem, just trying to establish a
timeline. :) )

I'm out of time to work on it today, just wanted to throw it out to
see if anyone can find the problem.  There's more info here:
http://wiki.wsmoak.net/cgi-bin/wiki.pl?ShaleValidator

[INFO] SEVERE: Servlet.service() for servlet faces threw exception
[INFO] java.lang.NullPointerException
[INFO]   at 
org.apache.shale.validator.CommonsValidator.getArgs(CommonsValidator.java:659)
[INFO]   at 
org.apache.shale.validator.CommonsValidator.getMethodParamNames(CommonsValidator.java:623)
[INFO]   at 
org.apache.shale.validator.CommonsValidator.loadMethodParamValues(CommonsValidator.java:757)
[INFO]   at 
org.apache.shale.validator.CommonsValidator.validate(CommonsValidator.java:846)
[INFO]   at 
javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:133)
...

web.xml
<context-param>
      <param-name>org.apache.shale.validator.VALIDATOR_RULES</param-name>
      <param-value>
          /org/apache/shale/validator/validator-rules.xml,
          /WEB-INF/custom-rules.xml
      </param-value>
   </context-param>

custom-rules.xml
<!DOCTYPE form-validation PUBLIC
         "-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.3.0//EN"
         "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd";>
<form-validation>
  <global>
      <validator name="evenInteger"
            classname="net.wsmoak.acctmtce.ValidationUtil"
            method="isEven"
            methodParams="int"
            msg="errors.even">
      </validator>
      ...
  </global>
</form-validation>

accessRequest.jsp
<h:form onsubmit="return validateForm(this);">
...
       <h:outputText value="#{messages['prompt.priority']}"/>
       <h:inputText     id="priority"
                     value="#{priority}">
           <s:commonsValidator
                       type="required"
                       arg="#{messages['prompt.priority']}"
                    server="true"
                    client="false"/>
           <s:commonsValidator
                    type="evenInteger"
                  server="true"
                  client="false"/>
       </h:inputText>
...

Thanks,
Wendy

Reply via email to