Hey Dave,

Referring to this:

> <forward   name="addCamper" contextRelative="true"
> path="/jsp/camper/addCamper.do" redirect="true"/>
>
The "path" attribute strikes me as being very suspicious, but you might
just be doing something... unexpected with how your application is set up.


Why does the path look a little suspicious to you?  I was thinking maybe I
am calling something in a weird way which was fine before but is causing
problems now.  How should the path look?

Cheers
Tom



On 2/7/06, Nick Sophinos <[EMAIL PROTECTED]> wrote:
>
> The initially easiest solution is to have a init version of that action.
> Note that it is a Forward Action, thus bypassing the need for a nearly
> empty backing Java class.
> ie:
> <action path="/AddCamperInit" type="
> org.apache.struts.actions.ForwardAction"
> parameter="/addCamper.jsp" />
>
> Alternatively, MappingDispatchAction is good here too, where one Action
> class
> can handle all cases, including the init case.
>
> - Nick
>
> On 2/7/06, Tom Ansley <[EMAIL PROTECTED]> wrote:
> > Hey Hubert,
> >
> > But how is anything going to ever validate correctly if I have not had
> time
> > to initially populate the form.  The action which is being skipped
> allows me
> > to prepopulate the form before sending it to the user for them to add
> > information.
> >
> > I get the feeling the workflow is something like
> >
> > 1.  Initial Action Ending with call to new action
> > 2.  Validate occurs
> > 3.  JSP Page displayed
> > 3.  New Action called after user request
> >
> > Instead of what I am used to:
> >
> > 1.  Initial action ending with call to new action
> > 2.  New action called
> > 3.  New action ends
> > 4.  JSP Page displayed
> > 5.  Validate occurs after user request.
> > 5.  New action called after validation succeeds.
> >
> > Cheers
> > Tom
> >
> > On 2/7/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > 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]
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to