struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: ActionForm's "getServlet" method and "servlet" attribute return n ull
Date Thu, 13 Mar 2003 20:24:55 GMT

On Thu, 13 Mar 2003, White, Joshua A (CASD, IT) wrote:

> Date: Thu, 13 Mar 2003 13:44:23 -0500
> From: "White, Joshua A (CASD, IT)" <>
> Reply-To: Struts Developers List <>
> To: 'Struts Developers List' <>
> Subject: ActionForm's "getServlet" method and "servlet" attribute return
>     n ull
> All,
> I am having problems with the ActionForm's "getServlet" method and "servlet"
> attribute.  I have created a class called "BaseForm" which simply extends
> ActionForm.  When I attempt to get a reference to the ActionServlet using
> the "getServlet" method or "servlet" attribute, I receive a null pointer
> exception.  I found a post on a similar problem (below).  Is this behavior
> still a bug?  I am also trying to get a reference to the ServeltContext.
> Regards,
> Joshua

If you are creating the form bean instance youself:

  MyFormBean mfb = new MyFormBean();

then it is your responsibility to call mfb.setServlet() in order to set
the "servlet" property.  Struts does this for you when it automatically
creates form bean instances.

You might also want to investigate whether using
RequestUtils.createActionForm() can help you.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message