tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kalyan Bitra <Kal...@exemplary.com>
Subject Help Forwading Session Variables
Date Mon, 14 Apr 2003 15:06:14 GMT
Hi All,

I'm trying to call a jsp from one using jsp:forward.  Just before forwarding
I'm setting some session values/attributes which I want to use in the called
jsp, but when I forward I'm loosing session variables. I'm here attaching
the code and env. To test just execute processLogin.jsp

I'm currently using Tomcat 4.1.24

processLogin.jsp
===================start================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@page contentType="text/html" session="true" %>

<html>
<head>
<title>Process Login</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<div align="center">
    session.setAttribute("check1", "Test1");
    session.putValue("check2", "Test2");
    <jsp:forward page="adminDashboard.jsp"/>
    session.setAttribute("check3", "Test1");
    session.putValue("check4", "Test2");
<br>
<div style="width:1px; height:50px"></div>
<br>

<!-- *** START PAGE FOOTER *** -->
<table cellspacing="0" cellpadding="0" border="0" width="700">
<tr>
</tr>
</table>
<!-- *** END PAGE FOOTER *** -->
</div>

<br>

</body>
</html>
===================end==============

adminDashboard.jsp

=================start===============
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@page contentType="text/html" session="true" %>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>

<div align="center">
<br>
<!-- START DATA HEADER -->
Session ID : <%= session.getId() %>
<br>
Session Attribute:  <%= session.getAttribute("check1") %>
<br>
Session Value:  <%= session.getValue("check2") %>
<br>
Session Attribute 3 :  <%= session.getAttribute("check3") %>
<br>
Session Value 4 :  <%= session.getValue("check4") %>
<!-- END DATA HEADER -->

<br>
<div style="width:1px; height:50px"></div>
<br>

<!-- *** START PAGE FOOTER *** -->
<table cellspacing="0" cellpadding="0" border="0" width="700">
<tr>
</tr>
</table>
<!-- *** END PAGE FOOTER *** -->
</div>

<br>

</body>
</html>
===============end===============

I'm 

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


Mime
View raw message