How do I share session between my JSP's and my Servlets?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stefan_Berg
Posted On:   Wednesday, September 26, 2001 12:13 PM

Hi, I have just set up my first Tomcat installation. Under webapps, I have defined a context "mycontext". Within this there is a dir for my JSP's called "jsp". Like this: /mycontext/jsp/mypage.jsp From the JSP page, I post a form to my servlet "myservlet" placed in a WEB-INF/classes dir. Like this: /mycontext/WEB-INF/classes/myservlet And here is my problem: When accessing the JSP page for the first time, a brand new session is initialized (cookie based). But when posting to the Servlet it starts yet another new session! WHY is this? I thought the session would be shared across JSP and Servlets within the   More>>

Hi,


I have just set up my first Tomcat installation.



Under webapps, I have defined a context "mycontext". Within this there is a dir for my JSP's called "jsp". Like this:



/mycontext/jsp/mypage.jsp


From the JSP page, I post a form to my servlet "myservlet" placed in a WEB-INF/classes dir. Like this:



/mycontext/WEB-INF/classes/myservlet



And here is my problem: When accessing the JSP page for the first time, a brand new session is initialized (cookie based). But when posting to the Servlet it starts yet another new session! WHY is this? I thought the session would be shared across JSP and Servlets within the same context.


I have tried this with both Tomcat 3.1.1 and Tomcat 3.2.3 with the same result. The JSP and Servlets are running under default configuration for the /webapps directory.


Please help me out here.


/Stefan

   <<Less

Re: How do I share session between my JSP's and my Servlets?

Posted By:   Alex_Chaffee  
Posted On:   Friday, October 26, 2001 08:35 AM

Sounds like a bug. You should post to tomcat-user (with subject header BUG:...) and see if it's known.
About | Sitemap | Contact