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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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 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: 8904

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: http://aspose.com/file-tools
subject: Session Problem
Similar Threads
Calling JNDI from JSP
HFSJ book: Cookie example chapter 6 plz Help :(
Url Rewriting
Get and Post with Init Params
Session Invalidate