File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Session Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Problem" Watch "Session Problem" New topic

Session Problem

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200

I tried the following coding for understanding the Session.
It is the form that having two fields 'name' and 'password'. When I submitted, it should go to with (Welcome name) and that screen will have another two fields 'age' and 'designation'. When I submitted this one, all the fields(name,password,age,designation) that are entered in the two forms should be displayed in the

But it returning as Null for all the fields. If I am getting using request.getParameter("name"), it's working. but using session.getAttribute("name" is not working, returing null.

Below is my coding:

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

The code does a session.setattribute("Name"...) but gets the value using sess.getAttribute("user"). The key used used in the set and get operation is different.
Replace sess.getAttribute("user") with sess.getAttribute("Name").

I agree. Here's the link:
subject: Session Problem
It's not a secret anymore!