tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Jacobson <>
Subject Re: session startup
Date Thu, 21 Nov 2002 09:24:50 GMT wrote:
> OK, 
>         Perhaps then a session is not what is required here. I wish to 
> make available upon startup of the server, some simple string values. They 
> must be accessible to all clients, auto initialised when the service 
> starts up. This is something similar to a posting I made a while ago 
> reagrding libraries. I want to load into memory these values when the 
> server starts, that will be accessible to all clients.
> Thanks
> Paul.

You need to implement a ContextListener class. Here's a snippet of what 
I have:

1) Java:

package com.terma.martin.drs.util;

import java.util.*;
import javax.servlet.*;

public class ApplicationInitializer implements ServletContextListener
	public void contextInitialized(ServletContextEvent sce)
		ServletContext ctx = sce.getServletContext();

		String propsFileName = ctx.getInitParameter("props-file");

... etc.

2) web.xml:




To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message