tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heligon Sandra <sandra.heli...@nextream.fr>
Subject RE: ServletContext in a Bean
Date Mon, 09 Sep 2002 16:19:52 GMT
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
independent
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: info@projektinter.net [mailto:info@projektinter.net]
Sent: 09 September 2002 17:09
To: Tomcat Users List
Subject: ServletContext in a Bean


Hi,

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

e.g.

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!

Rainer

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message