File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Context" Watch "Servlet Context" New topic

Servlet Context

Gregory Bonk

Joined: Aug 14, 2002
Posts: 1
Why does the serlvet context appear to change when I access the same server with a different URL? If I refer to a server like I will have a different servlet context from http://localhost/index.jsp when they are clearly accessing the same machine. Session attributes are different.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 672
The same machine can have many application thus many ServletContext.
However I think both and localhost/index should belong the default application.
Can you give more details?

We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Mario Rendon

Joined: Jul 11, 2002
Posts: 24
Well i have had that problem before ..

the session context is based on the Server "the browser sees"
sine the session is saved on a cookie called jsessionid this cookie is set to act on the context of the Server name .

that's why the context in localhost and are different..

also if you try autentications ( that is also a cookie ) are based on the same schema

Maybe it could be possible; if needed, to pass along the session ID to have the same context.

Grettings .
I agree. Here's the link:
subject: Servlet Context
jQuery in Action, 3rd edition