This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How to retrieve context parameter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retrieve context parameter?" Watch "How to retrieve context parameter?" New topic
Author

How to retrieve context parameter?

Taka Chan
Ranch Hand

Joined: Aug 19, 2004
Posts: 33
I am using Struts and Tomcat 5 and I have setup a parameter in web.xml as context parameter. I will like to know, is there any way I can retrieve value of this parameter from a class that is not inheriting HttpSerlvet ?

As I am a newbie and just know that I can retrieve this from the context of the web application. I would like to write a DAO class that does not inherite any class to retrieve the context paramter. Any suggestion?

Thank you in advance.


SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />SCEA(old version)...Part 1 Cleared<br />BearSoft Technology Group
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Your DAO probably shouldn't know anything about the code between it and the user.

I say it's a better idea to design the methods of the DAO so they accept that context value as a parameter.


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve context parameter?
 
Similar Threads
How to get method parameter names
how to get values from httpservlet to genericservlet
Why is servletConfig object is so special
IBM WAS environment variables
parameter vs attributes?