Some comments below...

Michael McGrady wrote the following on 9/13/2004 5:40 PM:

The following class works fine:

   public abstract class CrackWillowLookupDispatchAction
           extends DispatchAction {

     public ActionForward execute(
       ActionMapping mapping,
       ActionForm form,
       HttpServletRequest request,
       HttpServletResponse response)
           throws Exception {
           String methodName = ImageTagUtil.getName(request);
       return dispatchMethod(mapping, form, request, response, methodName);
     }
   }

Thanks for your comments below. It has helped clarify things. Your approach is pretty nice but in the above how would you be able to use this same Action for regular links? It seems like you have tied this Action to requiring use of hte ImageTagUtil which doesn't make too much sense for when you'd want to get to this action class from a standard link? (This was also my problem with the LookupDispatchAction that I didn't like... MappingDispatchAction solves all of this).


The other issues about this action have nothing to do with what I have been talking about, I think.

<html:form name='lookupForm' method='get' action='lookup.do' type='com.crackwillow.struts.form.LookupForm'>
<input type='submit' name='add.x' value='add'>
<input type='submit' name='delete.x' value='delete'>
</html:form>


This requires nothing in struts-config.xml.

Yes, that is a slight benefit (which is the same benefit of using the regular DispatchAction), however, the slight cost of having to rely on the struts-config for deciding what dispatch method is going to be called is worth it for the sake of consistency, since I don't have to worry about whether it's a link, button, image, or form submit. If I didn't want to use the struts-config simply using the standard DispatchAction works fine as well. Consistent.


<snip>


What my image is has nothing to do with what the name value is. The
name value is the command and is completely decoupled from the
image.

Yes, I see that now. That's good. Thanks for that clarification.

   The following simple code, in my solution, can replace a hugely
   complex series of relations and code in LookupActionMapping which
   drive you crazy and make any connection with ActionMapping's
   parameter attribute unnecessary as well.

Agreed. And definitely if I was going to go with a dispatch approach that relied on img/button names yours is a much more elequent solution. (I still like an onClick to a MappingDipsatchAction though:)



-- Rick

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



Reply via email to