how to use session tracking
i am making shopping mall project .
ist page conatins list of product avaiale
2nd page contains list of manufacturuer avaible
problem:-
i want to display on 3rd page the product seleted by user in 1st page
i used session tracking concept.but problem is the value is coming null in third page
please tell me how to solve my problem
i am doing in jsp page
like this in first page
session.setAttribute("theName", selection )
an d in third page i am calling using
sesion .getattribute("the name")
i dont know wheter it is enough to do .
else
tell me the way
If it is like a shopping cart, I suggest you to look for a good shopping cart examples available plenty online.
But if its just about keeping session variables and using them the following works.
Test with a simple example. Have three jsp files like a.jsp, b.jsp and c.jsp.
put the following in a.jsp
<% session.setAttribute("Mobile","Nokia");%>
<%=session.getAttribute("Mobile")%>
<a href="b.jsp">Go to B.jsp</a>
Print the value of session variable - <%=session.getAttribute("Mobile")%> in b.jsp and c.jsp
And in b.jsp have a link to c.jsp and so on. Once you set a session variable, it lives as long as your session doesnt expire.
Try it. and also look for more session tracking examples online.
Message was edited by:
passion_for_java