Hey Nick, Here is an excerpt of my CamperForm:
public final class CamperForm extends ValidatorForm { private Camper camper = null; public String getLastName() { return camper.getLastName(); } public String getFirstName() { return camper.getFirstName(); } Here is the error that is being returned: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod( PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty( PropertyUtilsBean.java:1132) at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty( PropertyUtilsBean.java:686) at org.apache.commons.beanutils.PropertyUtilsBean.getProperty( PropertyUtilsBean.java:715) at org.apache.commons.beanutils.PropertyUtils.getProperty( PropertyUtils.java:290) at org.apache.commons.validator.util.ValidatorUtils.getValueAsString (ValidatorUtils.java:105) at org.apache.struts.validator.FieldChecks.validateRequired( FieldChecks.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) .... .... Caused by: java.lang.NullPointerException at com.camp.forms.camper.CamperForm.getFirstName(Unknown Source) So, it's looking for getFirstName, which DOES exist in the form, except the "camper" object has not been populated yet because the action which populates it has not been called. Hence, the null pointer exception. Cheers Tom On 2/7/06, Nick Sophinos <[EMAIL PROTECTED]> wrote: > > I guess that the big question is: > "What about CamperForm?, what does it look like?" > If it is a Java class that you created, what does the validate() > method look like? If it is a DynaValidatiorForm (make sure that > it is not a DynaActionForm), what does the XML look like? > > - Nick > > On 2/7/06, Tom Ansley <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > I am trying to validate server side. I have an action which forwards to > > another action. If the original action has validate="true" then the > > forward > > doesn't happen and the validation tries to validate a null form. If > > validate="false" in the original action then everything works but no > > validation occurs. > > > > Does validator somehow alter the work flow in struts? My action doesn't > > get > > completely skipped because it does attempt to load a jsp page, but I > have > > no > > idea how it gets this jsp page and why it doesn't call the action. > > > > This seems very strange. The link appears on the html page like this: > > > > <a href="/camp/jsp/family/searchFamily.do?action=addCamper">Tom</a> > > > > So, the original action is "searchFamily" and the forward is > "addCamper". > > The forward happens inside the searchFamily action because I look for > the > > "action" parameter and forward according to that value. This forward > code > > is this: > > > > return (mapping.findForward(action)); > > > > Is this findForward not how I should be doing this? > > > > The struts-config excerpt for addCamper in the family module is: > > > > <forward name="addCamper" contextRelative="true" > > path="/jsp/camper/addCamper.do" redirect="true"/> > > > > and the excerpt in the camper module is: > > > > <action path="/addCamper" > > type="com.camp.actions.camper.addCamperAction" > > name="CamperForm" > > scope="session" > > validate="true" > > parameter="submit" > > input="/addCamper.jsp"> > > <forward name="add" path="/addCamper.jsp"/> > > <forward name="menu" contextRelative="true" > > path="/jsp/menu/Menu.do" redirect="true"/> > > <forward name="add_registration" contextRelative="true" > > path="/jsp/registration/addRegistration.do" redirect="true"/> > > </action> > > > > > >