Hi,
Does this mean that using action forwards To point another action is not action 
chainning?So we can call this action relay and its in line with Struts design 
principles?
 And as u said,We have really abstracted away all error handling etc to 
Abstract Action class.But the point is if we go withoput action chainning(or if 
we call it action relay),then to get the same page from different work flows,U 
may need to copy the same code to call service in muiltiple action classes.

my question  is what is the real disadvantage of using Atomic actions , if the 
are designed proper struts way(USing struts techniques so that they are not 
dealing with HTTP but directly getting objects from form beans..As u rightly 
said...)And then forward from one atomic action to another to complete a work 
flow..

regards
Shirish

-----Original Message-----
From: husted [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 12:34 PM
To: struts-user
Cc: husted
Subject: RE: design question about action chainning(As quoted in :Struts
in action...by Ted Husted et al..)


Derek Richardson writes:

 >But you still have to duplicate code in the actions, right? Even if
 >that code is as simple as:
 >
 >Service service = Service.getService(SERVICE_KEY);
 >Foo[] foos = service.getFoos();
 >request.setAttribute(FOO_KEY, foos);
 >
 >Action chaining allows this code to be written once and used many 
 >times. Thus you get reuse of presentation code, not just business
 >logic.

Personally, I would put utility code like this in a super class and make 
it available to whatever Action wanted to call it. Actions are 
instantiated once, and there is no performance penalty for have a deep 
hierarchy.

So there would be something like

setService(request)

that any Action could call.

The BaseAction in Scaffold makes good use of this technique for error 
handling and such.

What happens with true Action chaining (not to be confused with a simple 
Action relay) is that instead of using Java calls to create our 
presentation API, we start to use HTTP to make the API calls instead. 
IMHO, this is a step backward. The point of Struts is to get us up and 
out of HTTP and into an object-orientated domain, where we can write 
proper programs. (Rather than an endless chain of kludges.)

-Ted.



-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


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



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

Reply via email to