On 2/7/06, Tom Ansley <[EMAIL PROTECTED]> wrote:
> > > <action path="/addCamper"
> > >       type="com.camp.actions.camper.addCamperAction"
> > >       name="CamperForm"
> > >       scope="session"
> > >       validate="true"
> > >       parameter="submit"
> > >       input="/addCamper.jsp">
>
> 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.

This is your problem right here.  You request /addCamper which
validate='true'.  Because of this, Struts will always call validate(),
and so calls to your getters will be made.  Since your getters rely on
camper, and camper is null, you'll get NPE's each time.

The quickest way to fix this would be make sure camper is always
available before your getters are called.  The better way to fix this
would be to use a different action that doesn't require validation if
you don't have data to validate.

Hubert

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

Reply via email to