Hi John,
Find below the code snippet(Please ignore mistakes, I am a novice...), that
you have desired,
I agree that some people may require this and some may not, and thanks for
your motivating gesture.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have added following lines of code in the end of processActionPerform, (
after calling super.processActionPerform)
We maintain an object named UserContext in the session scope. here it has
been obtained with the name "uc"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ActionForward af = super.processActionPerform(request, response, action,
form, mapping);
 Stack fwdStack = uc.getActionFwdStack();
if ( fwdStack.size() == 0 )
{
  fwdStack.push(af.getPath());
}
  else if (!((String)fwdStack.lastElement()).equals(af.getPath()))
{
  fwdStack.push(af.getPath());
}

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have provided following method in the overridden DispatchAction class.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  public ActionForward getCallingForward(HttpServletRequest request)
  {
    UserContext uc = getUserContext(request);
    Stack fwdStack   = uc.getActionFwdStack();
    if ( fwdStack.size() > 0 )
    {
      fwdStack.pop();
    }
    String stPath    = (String)fwdStack.peek();
    ActionForward af = new ActionForward("CallingPage", stPath, false);
    return af;
  }
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Regards,
Puneet Agarwal

Tata Consultancy Services,
C-56, Phase - II, NOIDA 201305 (India)
Phone: +91-120-2461001, 2, 7, 8, 9, 12, 13 (Ext. 1044)
FAX              : +91-120-246 1521

Struts ... Action ... Struts in Action ... Action in Struts ...


                                                                                       
                            
                    john sessler                                                       
                            
                    <jqualityone@        To:     Struts Developers List <[EMAIL 
PROTECTED]>            
                    yahoo.com>           cc:                                           
                            
                                         Subject:     Re: What Do U think abt this 
feature                         
                    10/19/03                                                           
                            
                    10:13 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    "Struts                                                            
                            
                    Developers                                                         
                            
                    List"                                                              
                            
                                                                                       
                            
                                                                                       
                            




Hello Puneet,
Your extension looks useful to me. Thats just my opinion; others will
decide whether your ideas and code become part of Struts.

If your design includes a new request processor then it should work for
anyone needing your functionality and not needing the functionality
provided by some other request processor. This can be a go or no go
decision for some applications.

I see that you have overriden the processActionPerform method of the
request processor. There is ongoing work and discussion, much of it recent,
on how to best facilitate action invocation and control flow within the
Struts environment. I would be interested in seeing your implementation of
the processActionPerform method but, again, only from a curiosity
standpoint.

John A. Sessler

Puneet Agarwal <[EMAIL PROTECTED]> wrote:
Struts Developers,
This is one of my first few mails to this forum. I have been using struts
for almost 2 years now.

In our applications we have been having a need to navigate from one page to
another in a cris-cross manner.
Say a screen J1 could have been called from number of screens J2 to Jn.

On the Page J1 there is a close button or return button which causes the
control to return to the Calling page.

So we need an intellegence in the application to remember the stack of
screens.
We have implemented this by overriding the processActionPerform method of
RequestProcessor Class. There we maintain a java.util.Stack of the
ActionForwards.

And we have also extended the DispatchAction Class, where we have provided
a metod named getCallingForward(). Which returns an actionForward of the
last element in Stack.

If you guys think it can of any use, I shall pass it across.


Regards,
Puneet Agarwal

Tata Consultancy Services,
C-56, Phase - II, NOIDA 201305 (India)
Phone: +91-120-2461001, 2, 7, 8, 9, 12, 13 (Ext. 1044)
FAX              : +91-120-246 1521

Struts ... Action ... Struts in Action ... Action in Struts ...
DISCLAIMER: The information contained in this message is intended only and
solely for the addressed individual or entity indicated in this message and
for the exclusive use of the said addressed individual or entity indicated
in this message (or responsible for delivery of the message to such person)
and may contain legally privileged and confidential information belonging
to Tata Consultancy Services. It must not be printed, read, copied,
disclosed, forwarded, distributed or used (in whatsoever manner) by any
person other than the addressee. Unauthorized use, disclosure or copying is
strictly prohibited and may constitute unlawful act and can possibly
attract legal action, civil and/or criminal. The contents of this message
need not necessarily reflect or endorse the views of Tata Consultancy
Services on any subject matter. Any action taken or omitted to be taken
based on this message is entirely at your risk and neither the originator
of this message nor Tata Consultancy Services takes any responsibility or
liability towards the same. Opinions, conclusions and any other information
contained in this message that do not relate to the official business of
Tata Consultancy Services shall be understood as neither given nor endorsed
by Tata Consultancy Services or any affiliate of Tata Consultancy Services.
If you have received this message in error, you should destroy this message
and may please notify the sender by e-mail. Thank you.


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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search



DISCLAIMER: The information contained in this message is intended only and
solely for the addressed individual or entity indicated in this message and
for the exclusive use of the said addressed individual or entity indicated
in this message (or responsible for delivery of the message to such person)
and may contain legally privileged and confidential information belonging
to Tata Consultancy Services. It must not be printed, read, copied,
disclosed, forwarded, distributed or used (in whatsoever manner) by any
person other than the addressee. Unauthorized use, disclosure or copying is
strictly prohibited and may constitute unlawful act and can possibly
attract legal action, civil and/or criminal. The contents of this message
need not necessarily reflect or endorse the views of Tata Consultancy
Services on any subject matter. Any action taken or omitted to be taken
based on this message is entirely at your risk and neither the originator
of this message nor Tata Consultancy Services takes any responsibility or
liability towards the same. Opinions, conclusions and any other information
contained in this message that do not relate to the official business of
Tata Consultancy Services shall be understood as neither given nor endorsed
by Tata Consultancy Services or any affiliate of Tata Consultancy Services.
If you have received this message in error, you should destroy this message
and may please notify the sender by e-mail. Thank you.


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

Reply via email to