It's not a secret anymore!*
The moose likes Spring and the fly likes Struts 2, Spring Security 3.0 and Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Struts 2, Spring Security 3.0 and Ajax" Watch "Struts 2, Spring Security 3.0 and Ajax" New topic
Author

Struts 2, Spring Security 3.0 and Ajax

Glen Divers
Ranch Hand

Joined: Jan 21, 2010
Posts: 61
Scenario: After logging in, user runs Struts 2 action that displays a .jsp page that uses Struts2-Jquery tags to create a tabbed display that make Ajax calls to access their content from other struts actions. Walk away and let the session expire. Clicking on one of the tabs invokes the login page from Spring security as it should, except the login page appears as the content of the selected tab.

How(Can) I configure Spring security so that the login page always appears as a display in it's own right. If the login program was a Struts Action I'd do this as a "redirectAction", but I've no idea how to acheive this in Spring/Struts intergration.

Regards
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's the Ajax call that has to deal with the lack of logged-in-ness; it needs to redirect based on a response. I usually just use an error code, check for the error code in the response, and redirect via JavaScript.

This isn't really Struts-related; I'm going to move it to... Spring, since that'd be what needs to provide enough information for your JavaScript code to do the right thing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2, Spring Security 3.0 and Ajax
 
Similar Threads
ArrayList and Ajax
Ajax to show a table with Display tag
Spring security: pass additional parameter when performing login
Problem while redirecting to action class from AJAX
How to display page elements sequential in Struts2