File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Session Problem

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200
Hi,

I tried the following coding for understanding the Session.

Servlet1.java
-------------
It is the form that having two fields 'name' and 'password'. When I submitted, it should go to servlet2.java 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 servlet3.java.

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: 8919

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").


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Problem