• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Check User session when ajax aynchronous call is made

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
i have an application when a user selects a year it call the onChange method of the year combo and creates an xmlHttpRequest, assings a callback method (to render html when the request is complete) and call an action. The problem happens is when the user session is expired, i intercept the request in the mainactioncontroller, and it checks for the user session. and if it null it redirects the request to login.jsp page. But this is not happening and the controls comes back to the callback method to render the html and it results in some junk page. My architect suggested me to check in the call back method what is the req.responseText and set the req back to login.jsp page. Any idea what is hte most feasible way to handle this
Thanks
Rashid
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest you have your action return some agreed upon value ("NOSESSION" for example) if the session has expired. In your JavaScript on the client side, you can then check for this value and cause the login JSP to be displayed:

location.replace("login.jsp");
reply
    Bookmark Topic Watch Topic
  • New Topic