Hello Tomcat Users,
My Name is Purvang and I am using jakarta-tomcat-3.2.1 release. I have
configured Tomcat as a Web Container itself, meaning that Tomcat is not
connected to any other external Web Server and acts as a server itself
handling all servlet requests.
Tomcat is configured perfectly ok and is running fine. The only problems I
have is while implementiong "Session" in my servlets. I have a servlet say
"First" servlet, that create's an Httpsession using the getSession() method
and uses the setAttribute() method to bind/set the object in the session.
Below is an example code that I write in doPost()/doGet() method to create
a Session is servlet "First":
HttpSession session = request.getSession();
String usrid = "tomcat";
session.setAttribute("UserId",usrid);
Now in another servlet, lets call it "Second" servlet, when I try to create
a session and extract the value that is set in the above code, it throws a
NullPointerException, meaning that it did not find the session, which was
successfully created in the First servlet.
Example code in "Second" servlet to get the values bound/set in the session
created by the "First" servlet:
HttpSession session = request.getSession(false);
String test = (String) session.getAttribute("Userid");
The above line throws a NullPointerException.
Please help me out in implementing "Sessions" using tomcat as Session is a
very important feature and I am heavily relying on it.
Waiting for a fast reply.
Regards
Purvang
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]