I'm trying to use the setAttribute and getAttribute functions to store session variables. I have a jsp page Dashboard.jsp which includes
<%
session.setAttribute("test", "value");
out.print(session.getAttribute("test"));
%>
<a href = "temp.jsp">temp</a>
and another jsp page temp.jsp which just has
<%
out.print(session.getAttribute("test"));
%>
In the Dashboard page, it correctly outputs "value", but in the temp.jsp page it outputs null. Is there any other setup I have to do or anything? I've been trying to get this to work forever, but the session variable keeps turning into null when I change pages.
Thanks.
Edit: I'm using the Eclipse IDE for Java EE developers, so I was wondering if I have to change some settings or something, because it seems to me that my code is right, yet it is not working...
Edit: I used session.getID() and discovered that the session is changing when I go from the Dashboard.jsp page to the temp.jsp page. How do I keep the same session?