> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
>
> On Thu, 23 Jan 2003, Peter A. Pilgrim wrote:
>
> >
> > Actually, Craig, what I am looking for is:
> >
> > (1) How to find all the action mappings registered for a
> Struts application?
> > I would like to programmatically find out from inside
> `Action.execute()'.
>
> *If* you are a good boy :-) and route all your incoming
> requests through
> the controller servlet (as opposed to linking directly to a JSP page),
> then the controller servlet will have stored the ModuleConfig
> object for
> the selected application module as a request attribute under the key
> represented by Globals.APPLICATION_KEY
> ("org.apache.struts.action.MODULE"). From the ModuleConfig
> you can get
> everything you want to know that came from struts-config.xml for that
> module.
I normally am a good boy and route all the incoming through the
controller servlet. Your revelation allows me, I hope, to
develop a small API in the base class.
I can therefore interrogate the ModuleConfig and find the
registered actions in it. Therefore I can built a dynamic
action forward with the path set to the require ActionMapping.
Cool!
I guess what I am saying I can built a
`ActionForward BaseAction.transferRequest( "action-path", ... )'
or attempt to do it.
> >
> > (2) How to programmatically instantiate and then invoke an Action?
> > I guess this is really is Action chaining, isn't.
> > I would prefer to call it `transitioning' as in giving up the
> > responsibility to process a http request to secondary action.
> >
>
> Set up an ActionForward that has a request URL mapped to
> another Action,
> and return it from the first Action.
>
> Be aware that I'm *not* a believer in Action chaining -- too
> many people
> get surprised by the interactions with form beans when you do this.
> Instead, I advocate that the one-and-only Action that you
> submit to should
> delegate to all the individual pieces of business logic it
> needs to (in
> separate classes), and that you should reuse these business
> logic classes
> as needed in multiple actions.
Especially if the different form bean attributes have the
same name. It is not particularly water tight. I try to hold
off chaining or transiting where possible, but there are
situation where I need to create another action's associated
associated action form and set a value in it. Of course,
for any newbies reading this note, this foil will only work
if the action forms are in session scope.
> If we want a real "chain of responsibility" pattern (which is
> what action
> chaining is really about), we should set that up as a first
> class notion.
> That's one of the ideas I'm looking at for Struts 2.x. In
> the mean time,
> though, I consider action chaining to be a misuse of the current
> architecture -- although other Struts committers may disagree.
Which API style are you looking at closely?
1) ServletFilter style.
2) Swing UNDO style.
Can you reveal the possible XML config notion?
>
> > In another earlier note, I found a way to forward dispatch
> using request
> > attributes and local action forwards. I did it this way in
> Struts 1.0.2
> > seven or eight months ago.
> >
> > --
> > Peter Pilgrim
>
> Craig
--
Peter Pilgrim,
Struts/J2EE Consultant, RBoS FM, Risk IT
Tel: +44 (0)207-375-4923
********************************************************************
Visit our Internet site at http://www.rbsmarkets.com
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
Regulated by the Financial Services Authority
********************************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>