Date: 2004-09-18T19:51:51
Editor: SteveRaeburn <[EMAIL PROTECTED]>
Wiki: Apache Struts Wiki
Page: StrutsCatalogDispatchUtil
URL: http://wiki.apache.org/struts/StrutsCatalogDispatchUtil
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,15 +1,9 @@
##language:en
== Universal Button Utility for Struts ==
-(Critics please use Critics Corner at the end of this post. Thank you.)
-
There is a persistent problem of handling multiple buttons, and this is especially a
problem when the buttons are images. Struts has provided a solution for this with
DispatchAction and its progeny. There are various other solutions. I have provided
one at StrutsCatalogImageTagUtil. I have actually provided two solutions there. The
following solution is, I think, superior in every way. What it does is to merge the
best parts of StrutsCataglogImageTagUtil and DispatchAction.
-This is a solution for Struts. If you want a solution independent of Struts, again,
please see StrutsCatalogImageTagUtil. The principle reason for this class is the
problem with <input type='image' name='whatever'> tags in HTML. Those tag send the
values in the name attribute as ''whatever.x=9'' and ''whatever.y=26''.
DispatchAction and its progeny provide a melange of solutions but no common way to
deal with ''<a href='whatever.do'>'', ''<input type='submit'>'', ''<input
type='image'>'', ''<input type='file'>'', or whatever. This class, DispatchUtil does
that. If you prefer to use a subclass, just provide the functionality in this class
in a class extending Action. Herbert Rabago came up with the idea of providing the
functionality in a utility class and I really like that idea. So, here we go, after a
caveat.
-
-== Caveat Lector ==
-
-For those who have used MappedDispatchAction and LookupDispatchAction, this solution
will do everything that you are doing. You have to understand, however, which many
people seem to have a really, really, really hard time doing, that there is a
fundamental shift in how the logic in this class, DispatchUtil and its prior class
SimpleDispatchAction, cf. StrutsCatalogSimpleDispatchAction, work. There are those
who want to say the equivalent of "0 is just another number, so there is no big change
here". I cannot continue to try and awake them from their dogmatic slumbers. Let me
just say for the last time that the change from mining, getting, obtaining, etc. the
name from the name/value request parameter pair is a significant change that makes
DispatchUtil lighter, more flexible and less coupled in every respect. People
continue to argue and to insist that this class won't work as coded when it is doing
fine in actual sites.
+This is a solution for Struts. If you want a solution independent of Struts, again,
please see StrutsCatalogImageTagUtil. The principle reason for this class is the
problem with <input type='image' name='whatever'> tags in HTML. Those tag send the
values in the name attribute as ''whatever.x=9'' and ''whatever.y=26''.
DispatchAction and its progeny provide a melange of solutions but no common way to
deal with ''<a href='whatever.do'>'', ''<input type='submit'>'', ''<input
type='image'>'', ''<input type='file'>'', or whatever. This class, DispatchUtil does
that. If you prefer to use a subclass, just provide the functionality in this class
in a class extending Action. Herbert Rabago came up with the idea of providing the
functionality in a utility class and I really like that idea. So, here we go.
== Code ==
{{{
@@ -172,8 +166,3 @@
StrutsCatalogHidingImagesAndOtherResourcesUnderWEBINF
StrutsCatalogMappedBeans
-
-
-== Critics Corner ==
-
-If you don't like what is said or presented, and you want to advance your ideas,
please don't make this presentation a mess by doing it here. Please be respectful and
provide a link here to your ideas or initiate another space. Multiple authors
fundamentally in disagreement make a page unreadable. This page had to be moved from
StrutsCatalogSimpleDispatchAction because of such problems. Please don't repeat them
here. I love to read them but I love to keep things readable too. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]