struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glanville, Jay" <>
Subject How to best deal with circular work flow?
Date Fri, 16 Apr 2004 13:51:53 GMT
Hello all.

What is the best way to deal with request parameters when the work flow
goes: page -> action -> same page?

Ok, let me see if I can more accurately describe the situation.

I have a form.  Within that form, I have a table listing entities with a
column of indexed checkboxes which map to indexed properties on my
form-bean.  Also on that form, I have several buttons for batch-type
actions like "delete", "disable", "enable", etc.  These buttons need to
be "submit" buttons so that the checkbox values can be copied to the
form bean.

When a user presses one of these buttons, the associated Action then
looks at the array of buttons to see who was pressed, goes and performs
the work associated with that button, and then returns an ActionForward
that returns to the same page that the user originated from.  This
action forward needs to be of type "forward" (as opposed to "redirect")
because they might be some ActionMessages or ActionErrors resulting from
the work that was done.

My problem is this: when the control returns to the page, because it's a
forward, the request parameter for the button that was pressed
previously also gets forwarded.  This means that my action re-processes
the button press which then re-forwards to the same page, causing
infinite recursion.

I'm currently working around the problem by having a check in my action
where if any ActionMessages or ActionErrors exist in the request, then I
ignore all button presses.  However, I'm sure that this isn't the best
way to implement this.  One problem with this is that it relies on the
batch-button implementations to set a message to prevent having this

Basically, I want a way to remove the request parameter associated with
the button.  However, I know that's not possible without using a
redirect, which in turn destroys my messages.

What is the best/cleanest way to deal with this situation?  Suggestions?


Jay Glanville

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message