• 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

Dynamic redirection in struts

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a listings page which contain links for different actions.Each of those actions would require a user login before proceeding to the respective jsp page.

How do we dynamically pass in the input action/page to the login action.
On successul login,we need to redirect to that particular action/page from where the login action was triggered.

If this is not possible dynamically then we need to define separate actions for login from each of the page which requires a logged-in user.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Store the original URL in order to redirect to it after login. You could store it in the session or in a hidden parameter that gets carried along.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Certainly you can do that. In fact if you use Tomcat's inbuild security it does it automagically for you.

The basic idea is that you remember which page you were heading to when you triggered the login (eg storing it in session) and then head to that page once login succeeds.

The simplest way I could think of doing it would be to store the relevant "success" actionForward in session, and return that actionForward from your login action. Of course that might be oversimplifying things.

You might get more luck in the struts specific forum.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic