Hi,
I found the idea interesting..

But I have a couple of questions...

the assumption you are making here is entire request parameters are captured in the 
form...How else can you call some action if it does not have access to all the request 
parameters..

Also it means that the action have very clean code and no forwarding of Objects as 
request attributes etc...


But if these  rules are followed,what you have done will definately work.


regards,
Shirish.

-----Original Message-----
From: Guillermo Meyer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 24, 2003 12:11 PM
To: Struts Users Mailing List
Subject: Navigation Stack


Hi:
I'm working with a Struts 1.0 application. I extended Action to create a
base action that handles backwards navigation in a stack fashion.
Each method calls a "saveStep" method to the stack. This step has form,
mapping and dispatch name. Base action has a method called "stepBack"
that can be called from the browser by clicking the "back" button (not
browser back button, but a submit button). This stepBack method executes
the last step in the stack and goes backwards. Another features exists
like checkPoint step, and an undoStep to return from a validation in
Validator Form.

        public ActionForward stepBack(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
          throws Exception {
                NavigationStack ns =
this.retrieveNavigationStack(request);
                synchronized(ns) {
                        //if not reloading
                        StackStep ss = null;
                        if(this.isTokenValid(request)) {
                try {
                          ns.pop(); //last step, ignore it.
                    ss = ns.pop();
                } catch (Exception e){
                   return this.handleEmptyStack(mapping, form, request,
response);
                }
                        } else {
                                ss = ns.getLastPopped();
                        }
                        return ss.process(request, response);
                }
        }

        public void saveStep(ActionMapping mapping, ActionForm form,
HttpServletRequest req, String dispatchName, boolean isCheckPoint) {
                //si no se indic� invalidar el grabado...
                if(this.isStepValid(req)) {
                        NavigationStack ns =
this.retrieveNavigationStack(req);
                        synchronized(ns) {
                                StackStep newStep = new
StackStep(dispatchName, mapping, form, isCheckPoint);
                                newStep.setServlet(this.getServlet());
                                //lo apila siempre y cuando sean
distintos (el �ltimo y el nuevo)
                                if(!newStep.equals(ns.getLast())) {
                                        ns.push(newStep);
                                }
                                this.saveNavigationStack(req, ns);
                        }
                }
        }


I would like to know what you thing about this kind of navigation
management and know how are you dealing with this problem. With this
solution I can link 2 use case action (I designed one action for each
use case) and click back button to return wherever i was called.

Thanks in advance.

Guillermo Meyer
System Engineer.
EDS Argentina.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to