File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
IBM WAS environment variables
how to get values from httpservlet to genericservlet
How to get method parameter names
parameter vs attributes?
Why is servletConfig object is so special