You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vincent <vi...@xaymaca.com> on 2004/01/30 19:38:41 UTC

DyanActionValidatorForm clarification please

Hello All,
I am trying to get a multi page validation working right.
Before my page even load I get a 500 error from tomcat 4.1.29:

java.lang.NullPointerException
	at 
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorActionForm.java:115)

I am using struts release 1.1. I checked the source code and I see the 
offending lines:
     public ActionErrors validate(ActionMapping mapping, 
HttpServletRequest request) {
         // set the page variable before validating
         Map props = this.getMap();
         if (props.containsKey("page")) {
--->   this.page = ((Integer) props.get("page")).intValue();
         }


I'd like a few clarifications about what I have read on the list and
on the validator guide: 
<http://jakarta.apache.org/struts/userGuide/dev_validator.html>

Are the following assertions true or false?

To use DynaActionValidatorForm you must define a property in your 
ActionForm called "page" of type java.lang.Integer

In your web form you must have a tag with the page value:
<html:hidden property="page" value="1" />


On the page you must also have a tag like :

<html:javascript formName="/MyAction" method="validatesmyAction" 
page="1"  />

I have tried many permutations of these parameters.
I get a NullPointerException whether I have a "page" attribute in 
"field" element (gotta love the struts naming conventions :) )  in 
validation.xml or not. The exception only goes away if I set
validate to false in struts-config.xml

Thanks in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org