Are you sure you defined the form in the struts-config.xml file correctly?
That is the only reason I can think of why you would get a null pointer when
trying to access the variable 'form'.

The <form-bean> tag should be like:
    <form-bean name="myForm" type="[package].MyForm"/>,
and the <action> tag (from the path denoted in the html form) should have
the attribute:
    name="myForm".

If this isn't the reason, I don't know.  Someone else may.  Keep asking.

    - eric

----- Original Message -----
From: "Firmin David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 08, 2001 5:43 AM
Subject: RE: Help! Can't access ActionForm properties in Action perform()!


> Thanks, but sadly, that wasn't the problem, and I still haven't figured it
> out...
> The exception is being thrown from the Action's perform() method, meaning
> validation in the bean is successful, and therefore all the field names
> match up. For some reason when I reference the formbean in the action
> (having casted it: MyForm thisForm = (MyForm) form; ) the bean itself is
> null.
> I don't know why.
> Further suggestions gratefully received!
> Rgds
> David
>
>
> -----Original Message-----
> From: Dorai, Harish (c) [mailto:[EMAIL PROTECTED]]
> Sent: 08 March 2001 13:29
> To: '[EMAIL PROTECTED]'
> Subject: RE: Help! Can't access ActionForm properties in Action
> perform()!
>
>
> I also got a similar exception, and for me the reason was that I had
> different form field name and bean property name. Make sure that the form
> that you are submitting have the field names same as the ActionForm bean's
> properties.
>
>
>
> -----Original Message-----
> From: Firmin David [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 08, 2001 7:53 AM
> To: '[EMAIL PROTECTED]'
> Subject: Help! Can't access ActionForm properties in Action perform()!
>
>
> Hi all
> I've done something stupid. I know I have, but I can't figure out what....
> I'm trying to access the data entered by the user from the corresponding
> formbean in my action's perform method (really rudimentary stuff, I know),
> and I keep getting null pointers.
> I've followed exactly what was done in the example app:
>
> perform(blah blah, ActionForm form, etc.etc.){
> MyForm thisForm = (MyForm) form;
> thisForm.getSomething();
> }
>
> but my getSomething() gets nothing, and all I get is a null pointer
> exception, because thisForm == null.
> I'm fairly sure I've rooted through the documentation, but can't find much
> in the way of help.
>
> Anyone got any idea what I've overlooked? I know everything is mapped
right,
> as the input is validated successfully in the formbean, and the correct
> action is called.
>
> Thanks in advance
>
> Rgds
> David
>
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of
> The Capital Markets Company.
>
> http://www.capco.com
> ***********************************************************************
>
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of
> The Capital Markets Company.
>
> http://www.capco.com
> ***********************************************************************
>
>

Reply via email to