Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Infinite loop using LookupDispatchAction

 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page that allows the user to modify some data and then save it. After the data is saved I want to refresh the page. The problem that I'm having is that when the page is refreshed after the save, it fires the SAVE method again (and on into an infinite loop).

The action behind my page is a LookupDispatchAction with a mapped SAVE method and an UNSPECIFIED method to catch all unmapped actions. When the page is displayed for the first time I enter through the UNSPECIFIED method and retrieve data from the DB to display to the user. When the user selects the save button the code executes the mapped SAVE method and then attempts to refresh the page by forwarding the user back to the same page. I thought that I would re-enter the page through the UNSPECIFIED method (as I did the fist time the page was displayed) but I end up back in the SAVE again (and again, and again....). I need a way to refresh this page without coming back into the save method.

Any ideas? Is there something that needs to be cleared out after the first SAVE method has completed?

Thanks for the help.
 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. I needed to add redirect="true" to my struts.config file
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic