I'm having trouble getting a simple Validator to work in a module.  Is there
something special to modules I need to do to get the Validator to work?

Specifically, I'm getting a NullPointerException at
org.apache.struts.validator.Resources.getMessage(Resources.java:209).
Walking through the code (ya gotta love Open Source!), I can see that the
JavaScriptValidatorTag is not finding or creating or doing whatever it needs
to do to get a MessageResources object from application scope, thus causing
the NullPointer.

This happens at line 319 of
org/apache/struts/taglib/html/JavascriptValidatorTag.java where it runs this
line:

  MessageResources messages =
                    (MessageResources) pageContext.getAttribute(
                        bundle + config.getPrefix(),
                        PageContext.APPLICATION_SCOPE);

where  bundle + config.getPrefix() evaluates to
"org.apache.struts.action.MESSAGE/password".   The attribute it's trying to
get meshes with my module, which is named "password".

But where am I supposed to stick the messages, and what messages is it
talking about?   Do I need module-specific messages?

Some (possibly) relevant config file snippets are below.  Any help would be
appreciated:

web.xml:

  <init-param>
      <param-name>config/password</param-name>
      <param-value>/WEB-INF/password-config.xml</param-value>
    </init-param>
...
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>



password-config.xml:

<struts-config>
  <form-beans>
    <form-bean name="ForgotActionForm"
type="edu.umn.ncfpd.password.ForgotActionForm" />
  </form-beans>
  <action-mappings>
   <action name="ForgotActionForm"  path="/index"
type="edu.umn.ncfpd.password.ForgotAction" validate="false">
      <forward name="forward" path="/index.jsp" />
    </action>
    <action name="ForgotActionForm" path="/forgot"
type="edu.umn.ncfpd.password.ForgotAction" validate="false">
      <forward name="forward" path="/sent.jsp" />
    </action>
  </action-mappings>
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
value="/WEB-INF/validation.xml,/WEB-INF/validator-rules.xml" />
  </plug-in>
</struts-config>

validation.xml:
 <formset>
           <form name="ForgotActionForm" >
                     <field property="emailAddress" depends="required,email"
/>
                </form>
</formset>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to