tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: servlets have their own web app context?
Date Fri, 01 Sep 2000 18:25:58 GMT
"Shade, Christopher" wrote:

> The servlet 2.2 spec reads that "HttpSession objects must be scoped at the
> application / servlet context level." (section 7.3)  Does this mean that
> servlets get their own web app context?  Is it allowed to share a session
> between servlets and JSPs without setting the root in server.xml to the path
> of my JSPs?
> ...christopher

No, it means that sessions are not shared *between* web applications.  It is
entirely legitimate (and expected) that sessions will be shared among the
various servlets and JSP pages (which get compiled into servlets) that are part
of a single web application.  Such servlets and JSP pages also share a single
ServletContext, so that you can use servlet context attributes to share
application-global objects.

If you want your servlets and JSP pages to share session and servlet context
information, they must be part of the same <Context> (in Tomcat terms).  In
other words, all of them must be accessible with the same context path at the
beginning of the request URIs used to access them.

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message