This is my code: <% session.setAttribute("id",request.getParameter("idField")); session.setAttribute("Name",User.getRepresentative()); %> I get the idField from a html form and the name from a bean then I store them in the session. Simple, right. Then in the next jsp page, I try to read the Name and the id field but it displays null. This is how I try to read them: <%= session.getAttribute("Name") %> <br /> <%= session.getAttribute("id") %> I check the session Id, and they were the same on the two jsp pages. What am i doing wrong. I can't figure it out. Could it be that my tomcat is not configured right? Thanks in advance for your help.
Ahmad, It may sound silly but have you checked that your request.getParameter("idFeild") is pulling the value from the form and not just giving you a null? It might be worth checking. Just before setting it to session stick in a line like: System.out.println(request.getParameter("idField")); HTH
The secret to creativity is knowing how to hide your sources.
Yep, one thing to check is that you are writing values to the session and not just 'null', the other is to make sure the session ID is the same both times. There are times when you accidentally lose the session, and you'd have to solve this problem first. Dave