tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessio Fiore <afi...@alteanet.it>
Subject R: How to pass a global parameter to all servlet of a webapp
Date Mon, 06 May 2002 08:00:52 GMT
Hi, you can use context params in web.xml:

<context-param>
	<param-name>ConfigFilePath</param-name>
	<param-value>/foo/bar.properties</param-value>
</context-param>

Then you can read this parameter in all your servlets:

String strPath =
(String)(getServletConfig().getServletContext().getInitParameter("ConfigFile
Path"));

Regards
Alessio

-----Messaggio originale-----
Da: userlist@mithi.com [mailto:userlist@mithi.com]
Inviato: lunedì 6 maggio 2002 9.02
A: tomcat users list
Oggetto: How to pass a global parameter to all servlet of a webapp


I have a webapplication which has 20/25 servlets, I have kept all global
settings of the webapp in a property file and want to pass these property
file path to all servlet .
I came to know that for individual servlet I can define init parameters as 

        
            foo
            bar
        
But again defining these for all servlet is a problem, so I am looking for a
settings which will be accessible to all servlet from a webapp.

One way which I can think of is to pass argument to java using
CATALINA_OPTS, but then it becomes accessible to all webapps. 
So please tell me if there is any way to have gloabl init parameters for all
servlet/JSPs of a webapp?

thanks
Amol



- Disclaimer -
This email and any attachments thereto may contain information which is
confidential and/or protected by intellectual property rights and are
intended for the sole use of the recipient(s) named above. Any use of the
information contained herein (including, but not limited to, total or
partial reproduction, communication or distribution in any form) or the
taking of any action in reliance on the contents, by persons other than the
designated recipient(s) is strictly prohibited.

If you have received this email in error, please notify the sender either by
telephone or by email and delete the material from any computer.

Thank you for your cooperation. 



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message