tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: ServletContext in a Bean
Date Mon, 09 Sep 2002 16:39:50 GMT
I'm agree with Sandra.
If you need Context's informations in your bean, the Servlet should set them
on the bean. But the bean shouldn't access directly to the context.

-----Message d'origine-----
De : Heligon Sandra []
Envoyé : lundi 9 septembre 2002 18:20
À : 'Tomcat Users List'
Objet : RE: ServletContext in a Bean

For me, you don't have to access to the ServletContext in your bean,
because the bean belongs to the Business Model. The data model has to be
of the web. It can be shared by all applications (web or not).
It is the process which manipulates the bean (the Servlet) that must access
to the ServletContext.

-----Original Message-----
From: []
Sent: 09 September 2002 17:09
To: Tomcat Users List
Subject: ServletContext in a Bean


how can I access the ServeltContext in a bean?
Could you give me sample:


import javax.servlet.*;

// something like that, but getServletConfig() is of course not known in a
normal bean.
ServletContext ctx = getServletConfig().getServletContext();
String dbdriver = ctx.getAttribute(Constants.DBDRIVER);

thanks for any help!


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

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

View raw message