File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retrieve context parameter?" Watch "How to retrieve context parameter?" New topic

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

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.
subject: How to retrieve context parameter?
It's not a secret anymore!