better use
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<context-param>
<param-name>proxy_server</param-name>
<param-value>labproxy</param-value>
</context-param>
<context-param>
<param-name>proxy_port</param-name>
<param-value>8080</param-value>
</context-param>
.
.
.
and in your servlet use
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException
{
super.init(config);
ServletContext context = config.getServletContext();
PROXY_SERVER = context.getInitParameter("proxy_server");
Niv Maman - Vice President, R&D
Movious Inc.
E-mail : [EMAIL PROTECTED]
Mobile : +972 54 830880
Tel : +972 9 8858555
Fax : +972 9 8858556
-----Original Message-----
From: William Brogden [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 3:08 PM
To: [EMAIL PROTECTED]
Subject: Re: A lot of params equals in web.xml
Alberto wrote:
>
> Hi everyone.
> I've a question:
> in my web.xml I have a lot of servlets that use the same set of parameters
> (same param name, same param value). The value of these parameters could
> change a lot of time in a month so:
> there's a way to write only one set of param name / param value and call
it
> in all my servlet?
>
Sure - create all of those name/value pairs in a properties file
and have web.xml point to it.
In your init method use a java.util.Properties object to read
the properties file and recover the parameters that servlet needs.
I do this all the time, makes it easy to synchronize all servlets
with the same properties.
--
WBB - [EMAIL PROTECTED]
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP
ISBN 0-7821-2809-2
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]