You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by john sessler <jq...@yahoo.com> on 2003/10/01 21:35:24 UTC
Action Wrappers. 2nd Request for Comments & Code Contribution
Hello All,
I've developed code that I would like to submit for comment and
consideration for inclusion in the Struts code base whenever it becomes
ready for prime time. Following is a very brief description of the purpose
of the code. Complete information, code and API can be found here:
https://www.sistemas-jasper.com/indexStrutsActionWrappers.htm.
Action wrappers are Struts actions that invoke other actions. The design
goal of action wrappers was to sift common functionality from actions so
that it can be reused. Action wrappers are meant to be plug and play
components. They are useful because they allow the designer to apply common
functionality to application specific actions. They are rather like
decorators because they can be applied to and and removed from their wrapped
actions without modification of the wrapped action. Action wrappers are
configured in the Struts configuration file.
The idea for action wrappers originated from the need to protect JSP views
from being duplicated by the user simply by cutting and pasting the URL in a
new browser window address box. A problem very closely related to this one
which influenced the development of action wrappers is the problem of
insuring that an action is executed exactly one time even though the link or
form which leads to the action remains available to the user.
The code works without modification to existing Struts code (1.1). However,
it uses a somewhat uncertain mechanism to accomplish action invocation.
Please read the API docs for class ActionProcessor for a description of the
mechanism and for possible solutions.
I have never contributed code to an open source project before so I'd like
some guidance on how to go forward.
Thank you,
John A. Sessler
---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
Re: Action Wrappers. 2nd Request for Comments & Code Contribution
Posted by john sessler <jq...@yahoo.com>.
Hello All,
Thanx for the responses. I got none on the 1st attempt 6 weeks ago so I appreciate the interest. I'll try to respond to all in this single email.
Hubert Rabago wrote:
Can this be implemented as a plug-in instead? That
way, users will be aware about it and can consider it
in their designs but those that won't need it will not
be carrying the additional classes.
The implementation is not a plug-in per se. It uses a plug-in to invoke actions but the plug-in could be eliminated by a very simple (even trivial) change to the Struts code base. This is documented.
Sgarlata Matt wrote:
Your plug-in is a very frequently requested feature, but it definitely
looks
a lot like what is called "action chaining", which is not considered a
Struts best practice. ........
---------------------------------
I am keenly aware of action chaining and of existing literature, Struts mailing list threads and contributed implementations. Action wrappers MAY be chained because of the implementation design properties. Action wrappers simply allow greater flexibility of controller logic.
Sgarlata Matt wrote:
As a quick summary, action chaining is considered a bad
idea because it generally indicates that logic that should be in a separate business tier has been pushed up inappropriately to the presentation tier..........
---------------------------
Action wrappers very definitely do not address business tier logic. They flesh out the options available for controller logic. The specific action wrappers implemented so far have no relationship whatsoever with the business tier. In fact, they are further removed than the application actions which they invoke. For example, the monitor action wraps any any action that you want to execute only one time. The monitor knows nothing at all about the application or business logic. The application action does not know that it will only be exectuted one time. Now, you may be saying that the application action is the extra action that comes from bad design. However, this is not the case either since it is the ordinary Struts action that we know and love which handles the form bean, the action forwards, etc. etc Keeping with your advice this action invokes other method(s) to perform business logic.
Joe Germuska wrote:
I think the objection to chaining is more to do with the fact that it
re-invokes the RequestProcessor chain than because of any specifics
of how you organize your code......
---------------
Action wrappers work with the existing request process but there is a caveat that should be understood. There is also a simple work around for the Struts code base. Both the caveat and the work around are documented.
John A. Sessler
---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
Re: Action Wrappers. 2nd Request for Comments & Code Contribution
Posted by Joe Germuska <Jo...@Germuska.com>.
At 12:32 -0400 10/2/03, Sgarlata Matt wrote:
>Your plug-in is a very frequently requested feature, but it definitely looks
>a lot like what is called "action chaining", which is not considered a
>Struts best practice. You can search the mail archives for more
>information. As a quick summary, action chaining is considered a bad idea
>because it generally indicates that logic that should be in a separate
>business tier has been pushed up inappropriately to the presentation tier.
>If you are looking for a way to chain commands in the business tier you
>might want to investigate the Commons Chain package, which is currently in
>the jakarta commons sandbox.
I think the objection to chaining is more to do with the fact that it
re-invokes the RequestProcessor chain than because of any specifics
of how you organize your code.
At least, Ted is currently advocating (in another thread) that we
support one formalized way of chaining exactly two actions; that is,
to add support for an action registered to execute in the role of a
"ViewController".
I haven't had much time to look closely at the Action Wrappers
proposal, but it sounds like it may just be an alternative way of
achieving the same goal, perhaps with more flexibility. That doesn't
sound bad.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"We want beef in dessert if we can get it there."
-- Betty Hogan, Director of New Product Development, National
Cattlemen's Beef Association
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: Action Wrappers. 2nd Request for Comments & Code Contribution
Posted by Sgarlata Matt <sg...@bah.com>.
Hi,
I'm not a committer either, but I've been lurking on this list a bit and
have learned a thing or two.
Your plug-in is a very frequently requested feature, but it definitely looks
a lot like what is called "action chaining", which is not considered a
Struts best practice. You can search the mail archives for more
information. As a quick summary, action chaining is considered a bad idea
because it generally indicates that logic that should be in a separate
business tier has been pushed up inappropriately to the presentation tier.
If you are looking for a way to chain commands in the business tier you
might want to investigate the Commons Chain package, which is currently in
the jakarta commons sandbox.
If you still think your plug-in is worthwhile after reading why people
dislike Struts chaining, SourceForge could be a good place to get started.
Matt
----- Original Message -----
From: "john sessler" <jq...@yahoo.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, October 01, 2003 3:35 PM
Subject: Action Wrappers. 2nd Request for Comments & Code Contribution
> Hello All,
>
> I've developed code that I would like to submit for comment and
> consideration for inclusion in the Struts code base whenever it becomes
> ready for prime time. Following is a very brief description of the purpose
> of the code. Complete information, code and API can be found here:
> https://www.sistemas-jasper.com/indexStrutsActionWrappers.htm.
>
> Action wrappers are Struts actions that invoke other actions. The design
> goal of action wrappers was to sift common functionality from actions so
> that it can be reused. Action wrappers are meant to be plug and play
> components. They are useful because they allow the designer to apply
common
> functionality to application specific actions. They are rather like
> decorators because they can be applied to and and removed from their
wrapped
> actions without modification of the wrapped action. Action wrappers are
> configured in the Struts configuration file.
>
> The idea for action wrappers originated from the need to protect JSP
views
> from being duplicated by the user simply by cutting and pasting the URL in
a
> new browser window address box. A problem very closely related to this one
> which influenced the development of action wrappers is the problem of
> insuring that an action is executed exactly one time even though the link
or
> form which leads to the action remains available to the user.
>
> The code works without modification to existing Struts code (1.1).
However,
> it uses a somewhat uncertain mechanism to accomplish action invocation.
> Please read the API docs for class ActionProcessor for a description of
the
> mechanism and for possible solutions.
>
> I have never contributed code to an open source project before so I'd
like
> some guidance on how to go forward.
> Thank you,
> John A. Sessler
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org