tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shade, Christopher" <Christopher.Sh...@247media.com>
Subject RE: servlets have their own web app context?
Date Fri, 01 Sep 2000 19:05:27 GMT
thanks for clearing that up!  but is it true that the only way to do this in
Tomcat is to change the root in server.xml to match the path where the JSPs
are, because the /servlet has the root context?  is there a way for me to
invoke a servlet using something like
/whsp/servlet/com.blah.blah.SubscriberServlet while /whsp is a defined web
app?
thanks again, ...cxs

-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Friday, September 01, 2000 12:26 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: servlets have their own web app context?


"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