struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkat Maddipati <vmaddip...@Hyperion.com>
Subject RE: How to read a parameter in web.xml from Action class
Date Thu, 20 May 2004 15:27:40 GMT
Frank,

You can use the following in your Action class:

    String paramValue = this.servlet.getInitParameter("myParamName");

Thanks,
Venkat


-----Original Message-----
From: Frank Burns [mailto:frankburns@the-hub.demon.co.uk]
Sent: Wednesday, May 19, 2004 8:19 PM
To: Struts Users Mailing List
Subject: How to read a parameter in web.xml from Action class


Hi,

>From an Action class, I want to read a parameter specified in the web.xml
file. I thought I could place it in an <init-param> block, within the
<servlet-name>action</servlet-name> element, like this:

    <init-param>
      <param-name>myParamName</param-name>
      <param-value>myParamValue</param-value>
    </init-param>

and then read it within the Action class using:

    String paramValue =
request.getSession().getServletContext().getInitParameter("myParamValue");

But I get null.

What am I doing wrong?

Thanks,

Frank.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




************************************************************************

If you have received this e-mail in error, please delete it and notify the sender as soon
as possible. The contents of this e-mail may be confidential and the unauthorized use, copying,
or dissemination of it and any attachments to it, is prohibited. 

Internet communications are not secure and Hyperion does not, therefore, accept legal responsibility
for the contents of this message nor for any damage caused by viruses.  The views expressed
here do not necessarily represent those of Hyperion.

For more information about Hyperion, please visit our Web site at www.hyperion.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message