The underlying problem is that the framework does not generate the
request, the client does. The client is suppose to add certain
properties to a request, which I think include the referring page, but
you have no control over this, and personally, I would not depend on it. 

If there is information that should be part of a request, then it should
be part of the API contract, and included in the form or the link. If
the request is incomplete, then the client should be routed to an error
page.

Besides hidden properties, the parameter property in the ActionMapping
can often be used to map different tasks onto the same Action. 

If retaining a history of pages for your clients is important, that is
something you could create in the session and maintain with a subclass
of the ActionConroller. Each outgoing ActionForward could be added to a
self-limiting stack. However, Web application servers do not persist the
session, so if it times out, the history would be lost, unless you also
keep it in a cookie.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


Arnaud Chiaberge wrote:
> 
> Hi all,
> 
> I have exactly the same concern. I'm using one Actionform for several
> purposes (coming from different JSP pages), and I'd like ot be able to know
> where I come from...is it possible ?
> 
> Also, same problem when using an Action (a dispatcher one) that can be
> called from any JSP page...once again, I need to know from which JSP page
> this Action has been called (in this specific case, I don't have any
> "input=" entry ine the struts-config.xml file)
> 
> Thanks in advance for any help.
> 
> Arnaud Chiaberge
> 
> ----- Original Message -----
> From: "DUPRAT Alexandre" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, October 25, 2001 1:58 PM
> Subject: RE: Knowing where you came from
> 
> > Hi,
> >
> > I would be pretty interresting to know what is the action mapping when
> > validating an ActionForm.
> > We are using one form bean for 3 actions. We need to know what is the
> > current action but the form is validating before going to action.perform()
> > :-(
> > do something exist to help us?
> >
> >
> >
> > -----Message d'origine-----
> > De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Date: jeudi 25 octobre 2001 00:13
> > À: [EMAIL PROTECTED]
> > Objet: Re: Knowing where you came from
> >
> >
> >
> > Hi,
> >
> > It seems pretty common for applications to need some kind of "what screen
> /
> > logical function did the user get here from" mechanism.  I think it would
> > be interesting to try to build an xml driven navigation tool that would
> > work with struts forwardings / actions.
> >
> > The navigation bean could be kept on the session, and tell you:
> > - what logical function the user is currently at
> > - what logical functions should be available from the current function
> > - what function the user was at, if any, before arriving at the current
> > location - you could even keep a history here...
> >
> > For any given function, you can find out what the url is for that function
> > or what the global forwarding is for it, or what the action name is for
> it.
> >
> > An XML file could be built to configure the navigation bean, i.e.
> > <function name="viewWidgets" globalForwarding="viewWidgets">
> >      <navigation name="addWidget" actionName="addWidget.do"/>
> >      <navigation name="deleteWidget" actionName="deleteWidget.do"/>
> >      <navigation name="viewCustomers" globalForwarding="viewCustomers"/>
> > </function>
> >
> > You could use this for building navigation links in the JSPs dynamically
> > and handling "where did I come from" context sensitive requirements.
> >
> > I'm sure there's a lot wrong with this idea ;-).
> >
> > Jim W.
> > ThoughtWorks
> >
> >
> > At 10:20 AM 10/23/01, [EMAIL PROTECTED] wrote:
> > >In an Action, is there a way to determine if the request is coming from a
> > >forward from another Action or from an "external" request?  I've thought
> > >about storing in the session the last known request object and then
> > >comparing against it every time any of my actions perform() get called to
> > >see if the current request is the same as the last "known" request.  But
> > >this feels clunky.
> > >Are there any other ways to know where the request is coming from?
> > >
> > >         Eric
> > >--
> > >Eric Rizzo, Software Engineer
> > >OpenNetwork Technologies
> > >http://www.opennetwork.com
> > >-----------------------------
> > >I embrace my personality flaws, for without them
> > >I might have no personality at all.
> >
> >
> > Jim Weaver
> > Software Developer - ThoughtWorks
> >
> >
> >
> > +----------------------------------------------------------------+
> > | Ce courrier ainsi que les fichiers joints sont confidentiels.  |
> > | Si vous avez recu ce courrier par erreur, veuillez en informer |
> > | l'administrateur du systeme : [EMAIL PROTECTED]               |
> > |                          ---------                             |
> > | Ce message confirme que le courrier a passe le controle        |
> > | antivirus du relais de messagerie Internet avec succes.        |
> > +----------------------------------------------------------------+
> >

Reply via email to