You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/12/05 23:57:11 UTC

Re: Access of application-wide declared parameters from Action/ActionForm

"Mueller, Franz" wrote:

> Hello,
>
> is there a convenient way to access the ServletContext from an Action or
> from an ActionForm ?
>

The Action class receives a reference to the calling servlet as a parameter (in
Struts 0.5) or as a property that has been set via setServlet() (in Struts 1.0),
so you can call servlet.getServletContext() to gain access to application global
stuff.

In Struts 1.0, the ActionForm class also contains a "servlet" property that is
used the same way.  This was not possible in Struts 0.5.

>
> My problem,
>
> I've declared a couple of <context-param> in the web.xml.
> Some of them have the meaning of beeing used as default-values in the
> JSP-page.
> I have now the problem to pass this parameters/values to my ActionForm.
>
> Thanks in advance,
>
> fm

Craig McClanahan