Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Tomcat servlet problem with session attribute (http://www.velocityreviews.com/forums/t151500-tomcat-servlet-problem-with-session-attribute.html)

marco 03-24-2006 10:13 AM

Tomcat servlet problem with session attribute
 
A strange problem, I think...

I have a basic HTML form sending username and password to a servlet.
This servlet uses an external class to set up a DB connection, using
the username and the password to get the login access.
The HttpSession initialized on the first jsp is passed to the external
class such as a parameter in the constructor.
The external class istance (i.e., conn) execute the query to the DB,
and then returns to the servlet all the information.

As the results arrive to the servlet, the servlet itself sets up the
session attributes.
For example:

s.setAttribute("userId", conn.rs.getString("ID"));

My question is:

Why the command: s.getAttribute("userId") returns NULL?

Thank you.


josh.s17@gmail.com 03-24-2006 10:38 AM

Re: Tomcat servlet problem with session attribute
 
Are you sure that conn.rs.getString("ID") is returning something.
Sounds pretty straightforward. Might help if you post your code.


marco 03-24-2006 11:45 AM

Re: Tomcat servlet problem with session attribute
 
thank you so much, but I solved.

In fact, I was taking two times the same ResultSet, without doing the
BeforeFirst() the second time..... ;)



All times are GMT. The time now is 11:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.