You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/09/18 23:45:33 UTC

DispatchUtil and SimpleDispatchAction

Lets compare and contrast, on the one hand, DispatchAction and its 
progeny, and, on the other hand, DispatchUtil and SimpleDispatchAction.  
What they have in common is that they are patterns relating to Strust 
which obtain the method name for a class.  This was important initially 
because <input type='image'> does not have a parameter name one can 
mine, obtain, get, etc., when there are multiple images involved. 

Different Code

The two patterns use completely different logic to obtain the name of 
the method to use reflection on.  DispatchAction and its progeny go for 
the value of some parameter or property in HttpServletRequest or 
ActionMapping.  DispatchUtil and its assciated class go for the NAME of 
some request parameter or property in HttpServletRequest or 
ActionMapping.  If you don't want to use Struts, DispatchUtil has 
ImageTagUtil as your choice.  If you don't use Struts, the pattern in 
DispatchAction won't work for you without huge changes.  There are many, 
many other options we could discuss, if people did not keep thinking 
there was no difference and remain blind to the situation.

Common Code

The common code is the code that employs reflection AFTER the method 
name is obtain.  Niall notices this and thinks that the different 
classes are almost identical.  This reflection code is, of course, 
completely generic and has almost nothing to do with either action, and 
could be jettisoned without much ado.

Michael McGradt


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org