Link to home
Start Free TrialLog in
Avatar of inzaghi
inzaghi

asked on

servlet listener classes

Is it possible to pass in parameters to a Listener class in the web.xml simular to as you do with filters and servlets?
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Yes, for ServletContextListener:

      public void contextInitialized( ServletContextEvent sce ) {
            ServletContext sc = sce.getServletContext() ;
                String dbDriverName = sc.getInitParameter("dbDriverName");
      }
You can't directly with HttpSessionListener as you do not have access to the servlet context.
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial