You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Slimane Zouggari <sl...@clin.ucl.ac.be> on 2002/03/12 17:18:10 UTC

Problem with ActionForm

Hi,

I have a weird problem with a form which is always null.

For example, in my FooAction class, I have the following method:
>  public ActionForward perform(ActionMapping mapping,
>                              ActionForm form,
>                              HttpServletRequest request,
>                              HttpServletResponse response)
>   {

in that method I have the following code:

>FooForm theForm = (FooForm) form;

in my strus-config.xml:

><form-bean      name="fooform"
>             type="be.stluc.info.struts.FooForm"/>

...

>     <action    path="/foo"
>             type="be.stluc.info.struts.FooAction"
>             name="fooform" />

but when I try to use theForm (the object I initialized), I have a 
java.lang.NullPointerException, because theForm is null.

Could somebody please explain me what I'm doing wrong ????

Because I've done that for other classes and it works without any problem.

Friendly Regards,
Slimane


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem with ActionForm

Posted by Slimane <sl...@clin.ucl.ac.be>.
Ignore this mail, the fact that theForm was null, is only because I made a 
typo in the struts-config.xml !!! :(((
(in the action-mappings)

Sorry, for the annoyance :(

Friendly Regards,
Slimane

At 17:18 12/03/2002 +0100, you wrote:
>Hi,
>
>I have a weird problem with a form which is always null.
>
>For example, in my FooAction class, I have the following method:
>>  public ActionForward perform(ActionMapping mapping,
>>                              ActionForm form,
>>                              HttpServletRequest request,
>>                              HttpServletResponse response)
>>   {
>
>in that method I have the following code:
>
>>FooForm theForm = (FooForm) form;
>
>in my strus-config.xml:
>
>><form-bean      name="fooform"
>>             type="be.stluc.info.struts.FooForm"/>
>
>...
>
>>     <action    path="/foo"
>>             type="be.stluc.info.struts.FooAction"
>>             name="fooform" />
>
>but when I try to use theForm (the object I initialized), I have a 
>java.lang.NullPointerException, because theForm is null.
>
>Could somebody please explain me what I'm doing wrong ????
>
>Because I've done that for other classes and it works without any problem.
>
>Friendly Regards,
>Slimane
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>