You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Yee, Richard K,,DMDCWEST" <Ye...@osd.pentagon.mil> on 2004/02/10 19:43:36 UTC
RE: DyanActionValidatorForm clarification please
Vincent,
Do you have an entry in your map named page? Not having the entry will cause
your problem.
-Richard
-----Original Message-----
From: Vincent [mailto:vincent@xaymaca.com]
Sent: Friday, January 30, 2004 10:39 AM
To: Struts Users
Subject: 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(DynaValidatorAc
tionForm.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
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: DyanValidatorActionForm clarification please
Posted by Vincent <vi...@xaymaca.com>.
By map, do you mean ActionMapping? I included
the page attribute in validation.xml does it need to go somewhere
in struts-config.xml as well ?
<field property="theCard" depends="required,creditCard" page="1" >
<msg key="use.cc" name="required"/>
</field>
Is this wrong ?
Thanks.
Vincent
Yee, Richard K,,DMDCWEST wrote:
> Vincent,
> Do you have an entry in your map named page? Not having the entry will cause
> your problem.
>
> -Richard
>
>
> -----Original Message-----
> From: Vincent [mailto:vincent@xaymaca.com]
> Sent: Friday, January 30, 2004 10:39 AM
> To: Struts Users
> Subject: 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(DynaValidatorAc
> tionForm.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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org