Forums Register Login

Need some help regarding sessions

+Pie Number of slices to send: Send
Hi everybody, I have a problem with my application. In my application I have a login page, if the user is already logged in and requests for login page, he will be automatically redirected to home.jsp. If he is not logged in he will must get authenticated.

Now after the user logins from the browser, if he opens another window and tries to login from that one the, login page is recognizing the user as already logged in, the problem is arising if the user closes the browser and again wants to login. If the user closes the browser and opens a new browser then if he request for the login page he is not redirected to home page, he is asked to get authenticated. Why is this happening? Anybody please help me.

This is the code:

login.jsp


web.xml


Login.java


main.jsp


error.jsp


Please help me. Thank you all in advance.
+Pie Number of slices to send: Send
it is happening because the default lifetime of the JSESSIONID cookie is until a user closes the browser. if you don't want this to happen create a custom cookie and based on that you can create the session and condition for redirection.

avi sinha
+Pie Number of slices to send: Send
Thank you Avi, but what if the cookies are disabled. I can go with url encoding, but I don't know how to do that. Can you give me a sample example.

Thank you in advance.
+Pie Number of slices to send: Send
 

anusha chaitanya wrote:Thank you Avi, but what if the cookies are disabled. I can go with url encoding, but I don't know how to do that. Can you give me a sample example.

Thank you in advance.



well if cookies are disabled then you can implement url-rewriting easily by encoding all the urls or using <c:url value ../> (in encodes the url provided in the value) .
but in this case i can't suggest another option. wait for sometime some senior member will help you out with this.

avi sinha
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1493 times.
Similar Threads
Implementation of google charts in JSP
Do we have to configure web.xml for using jstl tags
Struts action not returning page on first click of button
Best choice for pagination?
JSTL choose not executing as expected
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:04:23.