This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Session Value Persistence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Value Persistence" Watch "Session Value Persistence" New topic

Session Value Persistence

Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
Hi All,

I have a file A.jsp(say), which takes a number as input. This page directs to B.jsp, where I store this number into the Session from request.getParameter().

B.jsp has a request dispatcher to c.jsp. C.jsp has a FORM ACTION=D.jsp.

In D.jsp however, when I try to retrieve the session value, it says null. What could be the reason?

Please help!

Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
Deepak Bala

Joined: Feb 24, 2006
Posts: 6661

What is this session's age ? Can you post some code ? Why dont you write an object that implements the session binding listener so you know when it gets unbound ? Just in case the session is being invalidated without you calling invalidate()

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
I have not set any AGE fot session. Nothing in DD or in my code. Code Sample Below:

<%@page import="java.util.*" %>

String s1 = "";
s1 = request.getParameter("application");

String s2 = request.getParameter("bg_instances");
ArrayList phyServers = new ArrayList(Integer.parseInt((String)session.getAttribute("numServers")));


if(Integer.parseInt((String)session.getAttribute("numServers"))!= 0)

<form action="step_3_controller.jsp" method="POST">

int numServersVal = Integer.parseInt((String)session.getAttribute("numServers")) - 1 ;
String s = ""+numServersVal;

<%@include file="/jsp/portfolio_gen/PhysicalServerView.jspf" %>

<input type="submit" value="next" />


<jsp:useBean id="phyServer" class="" />

<jsp:setProperty name="phyServer" property="serverName" value='<%=request.getParameter("p_sName")%>' />
<jsp:setProperty name="phyServer" property="serverType" value='<%=request.getParameter("p_sType")%>' />
<jsp:setProperty name="phyServer" property="serverGenre" value='<%=request.getParameter("p_sGenre")%>' />
<jsp:setProperty name="phyServer" property="serverIP" value='<%=request.getParameter("p_sIP")%>' />
<jsp:setProperty name="phyServer" property="userName" value='<%=request.getParameter("p_sUser")%>' />
<jsp:setProperty name="phyServer" property="password" value='<%=request.getParameter("p_sPass")%>' />
<jsp:setProperty name="phyServer" property="howToAccess" value='<%=request.getParameter("p_sAccess")%>' />
<jsp:setProperty name="phyServer" property="directoriesForApp" value='<%=request.getParameter("p_sRefer")%>' />

ArrayList phyServers = (ArrayList) session.getAttribute("phyServers");
System.out.println("phySevers :"+phyServers);



in step_3_controller.jsp, last but FOURTH line "System.out.println("phySevers :"+phyServers);" GIVES ME NULL.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Then you need to first verify the default that your container uses for the age os a session.

So much trouble in the world -- Bob Marley
Don't get me started about those stupid light bulbs.
subject: Session Value Persistence
Similar Threads
current JSP page v/s current JSP file!!
Problem caused by pressing the 'BACK' button on the broswer
Relative URL specifications, JSP 1.2.1
how to redirect page