Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Infinite loop using LookupDispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Infinite loop using LookupDispatchAction" Watch "Infinite loop using LookupDispatchAction" New topic

Infinite loop using LookupDispatchAction

Ben Hagadorn

Joined: Mar 28, 2006
Posts: 25
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

Joined: Mar 28, 2006
Posts: 25
I got it. I needed to add redirect="true" to my struts.config file
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Infinite loop using LookupDispatchAction
Similar Threads
LookupDispatchAction and enter key
Caching Problems with borwsers.
Application flow
Cache control through response object.
How to stop user entering a record twice?