File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes [Struts]  Handling Concurrent Actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[Struts]  Handling Concurrent Actions" Watch "[Struts]  Handling Concurrent Actions" New topic

[Struts] Handling Concurrent Actions

Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
I am currently working on a frame-based application in which the left frame displays a server-side navigation tree and the right frame displays workpages.
Until now, clicking an element in the navigation tree resulting in displaying a new workpage in the right frame.
I have been asked to make the tree more "intelligent" such that it highlights the current branch and displays a branch's open/close states as well. In order to do this, though, I need to generate two actions for each click of the navigation tree, i.e. one action to refresh the tree display and another action to display the workpage.
There are several ways of doing this:
1. Modify my navigation links so that the frameset is invoked when a tree element is invoked. The frameset when takes on the responsibility of refreshing each of the individual pages.
2. Find a way of chaining my struts actions together so that the invoking of one leads to the invoking of another.
3. Write a pre-processing Filter class that intercepts all client requests and issues a refresh-tree action before forwarding the request to the Struts Controller. The Struts Controller would then take on the responsibility of handling the workpage action.
4. Subclass the Struts Controller (in particular, its 'processForward', 'processInclude', 'processActionPerform', or 'processActionForward' methods) so that it refreshes the navigation tree in the background for each action sent to it (or a subclass of actions thereof.)
Has anyone had to deal with this issue? Does anyone have any suggestions on how to implement the forking of actions without having substantially to rewrite my struts-config file and/or action methods?
PS: I think that #1 is the preferred method. However it would involve a substantial re-write of my code so I am not considering it. I am inclined to adopt #3 or #4.
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
I withdraw my question. After thinking about it a bit, I've come to think that I have to return a frameset to the client browser that contains the hyperlinks needed to refresh the two frames. If I try to spawn two responses for a single request on the server, I don't see how the client would know to catch the two responses. Frame requests have to originate from the client.
Cheers and thanks,
I agree. Here's the link:
subject: [Struts] Handling Concurrent Actions
Similar Threads
More MVC......question for Mark
extra blank lines appearing on page on using tiles
using req:setAttribute
struts forwarding to a new frameset
Frame/Frameset Framework