• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Need some help regarding sessions

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic