Am I right in thinking that your solution works for image buttons, whereas
the LookupDispatchAction is for text labeled buttons?

Paul

> -----Original Message-----
> From: Michael McGrady [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 27, 2004 2:35 PM
> To: Struts Users Mailing List
> Subject: Re: LookupDispatchAction (Newbie)
> 
> 
> Once you see how LookupDispatchAction works, you should also 
> see that it 
> is an unnecessarily complicated solution.  Try 
> http://wiki.apache.org/struts/StrutsCatalogMultipleImageTagsSi
> mplified 
> which shows that all you have to do is:
> 
>     String button = null;
>     Enumeration enum = request.getParameterNames();
>     String parameterName = null;
>     while(enum.hasMoreElements()) {
>       parameterName = (String)enum.nextElement();
>       if(parameterName.endsWith(".x")) {
>         button = 
> parameterName.substring(0,parameterName.indexOf('.'));
>       }
> 
>     }
> 
> Isn't that a great deal simpler?  If you want to solve it 
> with a class, 
> then do somethin like:
> 
> *public class ImageTagUtil {
>   public static String getName(HttpServletRequest request) {
>     String command = null;
>     String buttonValue = null;
>     Enumeration enum = request.getParameterNames();
> 
>     while(enum.hasMoreElements()) {
>       buttonValue = (String)enum.nextElement();
>       if(buttonValue.endsWith(".x")) {
>         command = buttonValue.substring(0,buttonValue.indexOf('.'));
>       }
>     }
>     return command;
>   }
> }*
> 
> However, if you love the complications, essentially the idea 
> is to put 
> the paramter value together with method names in order to map the 
> buttons to methods.  So, if you have buttons returning button.add and 
> button.delete, your parameter value will be "button".  Once you know 
> that the parameter is button, then you can search for button.? and ? 
> will be the method name.  This is a totally unnecessary complication, 
> since we already have .x and .y at the end so generously 
> supplied by the 
> standard HTML.  So the above code does the same thing without 
> tying the 
> solution to the parameter value, which frees the parameter value for 
> other uses and which decouples the solution from struts.
> 
> Regards,
> 
> Michael
> 
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


**********************************************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.
**********************************************************************


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

Reply via email to