Date: 2004-08-10T21:50:24
Editor: MichaelMcGrady <[EMAIL PROTECTED]>
Wiki: Apache Struts Wiki
Page: StrutsCatalogMultipleImageButtonsWithNoJavaScript
URL: http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,6 +1,8 @@
StrutsCatalog: '''Here are TWO WAYS to take care of that pesky and recurrent problem
of how to use multiple image buttons in your forms. This solution will suggest other
possibilities you might want to code for yourself. Use the one you like best.'''
-First, you can merely mine the parameterNames of the request and build your logic in
your processing of the request accordingly.
+SOLUTION ONE: THE PREFERRED SOLUTION
+
+First, you can merely mine the parameterNames of the request and build your logic in
your processing of the request accordingly. This is by far the best solution, in my
opinion. It is simple and extensible.
{{{
public final class ButtonCommand {
@@ -42,7 +44,11 @@
}
}}}
-If you want something more OOP in nature, then the following might be your choice.
+This solution does not need to use the !ButtonConstant class or any other particular
logic. Most importantly, there is very, very little overhead either in footprint or
in calculations with this solutions. A vastly inferior, but more typical solution
follows.
+
+SOLUTION TWO: THE TYPICAL BUT INFERIOR SOLUTION TYPE.
+
+Second, if you want something ostensibly more OOP in nature, then the following might
be your choice. I have come to think the following is a mistake and but another
instance of overthinking a solution. This second option is a bit better than some
solutions, since it has a small footprint comparatively. But it is really a dinosaur
in my opinion.
The Struts page tags are simple. If you have buttons you want called "submit" and
"clear" for example, you would have the following page tags:
@@ -130,7 +136,7 @@
Just an extension.
-Instead of checking the command value in the execute method of the Action, you can
make your Action extend DispatchAction by overriding the protected dispatchMethod
+Instead of checking the command value in the execute method of the Action, you can
make your Action extend !DispatchAction by overriding the protected dispatchMethod
{{{
public class TestAction extends DispatchAction {
@@ -204,7 +210,7 @@
}}}
-If we are dealing with too many images, then it's better to make it an DispathAction
similar to the one illustrated above. One thing to remember is to define a parameter
in the ActionMapping.
+If we are dealing with too many images, then it's better to make it an !DispathAction
similar to the one illustrated above. One thing to remember is to define a parameter
in the !ActionMapping.
Thanks,
Kishore Senji.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]