• 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

Session Management with Ajax

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have a problem with session management with ajax requests. In my application I'm using struts1.2.9 and hibernate 3.
In my usecase I've to check the user existance in session. If user exist in the session then it should get into the application, if not it should redirect to login page.
I used filter to check the session existance and redirecting the request to the login page if user doesn't exist.

But here my problem is in my application there several ajax requests are there.
For every request its checking for the session and if the session doesn't exist its redirecting to the login page.
everything working fine with normal requests. But when any ajax request occurs the login page is loaded in a specific "DIV" .

So instead of loading the entire page , some divs only getting loaded with the login page.

i don't know how to solve this problem.
My code is given below


and my web.xml form mapping is



Thanks in advance

Regards,
Satish Raj.

 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't show us the AJAX code. Anyways, in your AJAX code, try to see the response's status code. If the status code of the response is 307 (or anything between 300 and 399), then that means that the AJAX call was redirected. Then you can redirect the page in JS using location.href and the Location header of the response. Similar examples can be seen here and here...
 
reply
    Bookmark Topic Watch Topic
  • New Topic