I am trying to store login information in an HttpSession and then check that the user is logged in at the beginning of each servlet in our system. Setting the information seems to work OK; however, when I go to retreive that information I discover that the session does not exist. What am I doing wrong here? (I'm using Applets that communicate with servlets which in turn communicate with EJBs). //Set the information in one servlet
//Get the value in another servlet
//And the Reult of the println
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Hello, Couldn't you just call request.getSession(); in your preCondition method instead of stipulating the value false. That retrieves the session associated with the user. Then if you are worried about it being new use the test session.isNew(), If it is new then that test failed and you can redirect to the login or whatever, Tom
Originally posted by William Brogden Are both servlets in the same web application? Sessions are only visible inside the web application.
Yes, both are running in the same web application.
Originally posted by tom boshell Hello, Couldn't you just call request.getSession(); in your preCondition method instead of stipulating the value false. That retrieves the session associated with the user. Then if you are worried about it being new use the test session.isNew(), If it is new then that test failed and you can redirect to the login or whatever
This is what I am doing when the user logs in. However, I need not only to know that a valid user is logged in but also who that user is; thus, I don't want to create a new session. I need the old one and the information about who is logged in. [This message has been edited by Joel McNary (edited September 14, 2001).]
Session IDs (if one exist) get passed on each request by the client either via cookies or URL encode. Are cookies turned off in the browser or your web.xml descriptor ? _________________________ Rama Raghavan SCJP2 [This message has been edited by Rama Raghavan (edited September 14, 2001).]
Thank you all for your help, but I managed to identify the issue. For general knowledge, here is what was going on: The applet would establish a connection to a servlet to pass data back and forth. However, this was a different session from the one that the browser had initiated. Thus, when I set the current employee information in the session of the applet's connection, that information would not be there when the browser went to another page. I worked around this by having the next page the browser go to take userName as a URL parameter and set up the current user there, and then redirect to the appropriate servlet. Again, that you all for you help.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com