aspose file tools
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

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

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

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.

David Newton

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.
rocket mass heater kickstarter
subject: Struts 2, Spring Security 3.0 and Ajax