File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes How to Access getInitParamter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to Access getInitParamter() " Watch "How to Access getInitParamter() " New topic

How to Access getInitParamter()

Kapil Keskar
Ranch Hand

Joined: Dec 04, 2001
Posts: 47
Here I want to get the Initialized parameters from 'Server.xml' file in Tomcat Configuration Dir.
I am having problem of how to update the config/server.xml or web-inf/web.xml file on server & by which code. Can any body tell me about this?
Thanking You
makiey bartsch

Joined: Feb 27, 2002
Posts: 11
1. Put the init-param into the web.xml:
2. Somewhere in your servlet ask for the param-value i.e.:
public void init() throws...
String myParamValue =
// do something with myParamValue...
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Make sure you give your servlet a registered name. Initialization parameters are not available in servlets that are accessed by their default URL.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: How to Access getInitParamter()
jQuery in Action, 3rd edition