Hi, DispatchAction dispatches the action based on the parameter value. where as lookupdispatchAction which is a subclass of it, inherits all the properties but has one more additional method called getmethodkey() for all those mappings ... ex. specified in properties file.s.. -eswar
Joined: Jul 27, 2005
thats fine...but what is the use of the HashMap . Why do we need to store all the values in the key value pair.Can you please explanin with the practical example
You could then use DispatchAction and code the methods add(), update(), and delete(), and Struts would forward to the appropriate method based on the button pressed.
However, if you use internationalization, this won't work because the label of the button could be in any number of languages. In this case, you need to use LookupDispatch action and code your JSP like this:
You'll then code the getMethodKey() to find the appropriate method based on the message key. That way, regardless of what language is actually used at runtime, Struts will still dispatch to the correct method.
Although this post is very old, I do not want to start a new thread.....a part of my question is answered here I think....I am not able to differentiate between the use of LookupDispatch action and Dispatch action. what lacks in dispatch action so that we have to use Lookup dispatch action?
the value of the parameter 'action' will be selected from the caption of the buttons? How the value of the action parameter is selected? If this is true, then it may also mean that the captions on the buttons should match the method names in the action class?