session value in java

First, I send user id from jsp page to servlet. That value received on servlet page like this :-

String username = request.getParameter("user");

Then creating the session true on servlet like this:-

HttpSession session = request.getSession(true);

After that I set the value using setAttribute method

session.setAttribute("user_id", username);

When I receiving session value using getAttribute method it display null on jsp page. my code is:-

String usercode = (String) session.getAttribute("user_id");

I am using Oracle JDeveloper 10g Relaese 2 as Editor.

[610 byte] By [AlokSinhaa] at [2007-11-26 21:25:55]
# 1
Hi Alok,The way you tried is correct but can u paste the code here to find the fault
Chellama at 2007-7-10 3:06:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
perhaps you are doing a redirect in stead of a forward to your jsp?
gimbal2a at 2007-7-10 3:06:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...