You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Padraig Cooney <pa...@easiwebmaker.ie> on 2003/05/23 16:33:52 UTC

Rproblem: New Session created on each new JSP

Dear friends, 

I have problem in a JSP app run on tomcat3.3 whereby a session does not exist for more than one page. The problem is encountered whenever I try to use a session variable created in a previous JSP. I have done my system.outs and a new session is created from page to page instead of using the existing session. This is what I posted on one of the forums: 
My problem is that I can't maintain a session over more than one page. I create a session in validateLogin.jsp: 

isAdmin = customerProfileBean.isUserAdmin(username); 

session.setAttribute("userType",isAdmin);
System.out.println("User Type is "+isAdmin+" in validateLogin");
session.setAttribute("user",username);
System.out.println("Max Inactive Interval is: "+session.getMaxInactiveInterval());
System.out.println("Session.isNew() is "+session.isNew()+" in validate");
System.out.println("Session.getId() is "+session.getId()+" in validate");

Then I re-direct to myLucidity.jsp, and try to access the session: 

String user = null;
user = (String)session.getAttribute("user");
System.out.println("User is "+user+" in myLucidity");
System.out.println("Session.isNew() is "+session.isNew()+" in myLucidity");
System.out.println("Session.getId() is "+session.getId()+" in myLucidity"); 

session.isNew() is "true" in both cases, and session.getId() returns different values. In other words, a new session is created in myLucidity.jsp rather than using the session started in validateLogin.jsp, as it should.

I have checked the max inactive interval for the session and it's 1800, so that's not the problem. 

My browser is set to "Accept All Cookies", so they're stored locally. In server.xml, I have: 
<SessionId cookiesFirst="true" noCookies="false" /> 
and 
<SimpleSessionStore maxActiveSessions="-1" /> 
Can anyone help?



Regards,

Padraig Cooney.

EASIREG.IE & EASIWEBMAKER.IE
Registration House
3 Woodbine Park
Blackrock
Co Dublin
Ireland

T +353 1 2830777
F +353 1 2830787
W www.easireg.ie
E padraig@easiwebmaker.ie

*************************************************************************************
Founding Member of RAID - Registrars Association of Internet Domains
Member of the IE Domain Registry Affiliate Program
Member of the IIA - Irish Internet Association
*************************************************************************************

*************************************************************************************
The information contained in this communication is intended solely for 
the use of the individual or entity to whom it is addressed and others
authorized to receive it.  It may contain confidential or legally
privileged information.  If you are not the intended recipient you are
hereby notified that any disclosure, copying, distribution or taking any
action in reliance on the contents of this information is strictly 
prohibited and may be unlawful.  If you have received this communication
in error, please notify us immediately by responding to this email and 
then deleting it from your system.  Easireg.ie is neither liable for the 
proper and complete transmission of the information contained in this 
communication nor for any delay in its receipt.
*************************************************************************************

*************************************************************************************
This footnote also confirms that this email message has been checked 
for the presence of Computer viruses by www.mcafee.com
*************************************************************************************

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