You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by nikhil Jain <ni...@wiproge.gsoi.med.ge.com> on 2001/11/09 12:47:59 UTC
tomcat finds lost session
i am new to servlets and jsp .
this seeems to be a tomcat problem:
i am forwarding a request from servlet to jsp using requestDispatcher ,
in that jsp , i am createing two child frames and calling two jsp into
targets of those frames
example :
<%@ page language = "java" import = "java.io.*,java.util.* " session="false"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<%
javax.servlet.http.HttpSession aSession=request.getSession(false);
System.out.println("session :" +aSession);
aSession.setAttribute("hello","hello world");
%>
<FRAMESET border=0 frameBorder=1 frameSpacing=0 cols="*,150" TOPMARGIN="0"
LEFTMARGIN="0" >
<frame name = "frame8" src =first.jsp scrolling=no >
<frame src=second.jsp scrolling=no name = "frame9">
</frameset>
</HTML>
for this jsp prints like :
session :org.apache.tomcat.session.StandardSession@36667228
now when i print session in first.jsp , tomcat server first shows me session
is null
throws null pointer exception on using it.
but again somehow it finds the session and shows me old session id.and works
fine
first.jsp
<%@ page language = "java" import = "java.io.*,java.util.* " session="false"
%>
<%
javax.servlet.http.HttpSession
aSession=request.getSession(false);
System.out.println("session in first.jsp = " +aSession);
System.out.println(" string= "+(String)aSession.getAttribute("hello"));
%>
<html>
<head>
<title>my jsp</title></head>
<body bgcolor="#FEFEF0"></body></html>
print like this on server:
session in first.jsp =null
throws null pointer exception
session in first.jsp =org.apache.tomcat.session.StandardSession@36667228
string=hello world
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>