Tutorial Home
Hibernate
StrutsJSP
Spring
|
LookupDispatchAction
LookupDispatchAction is another useful built-in Struts Action.
When a set of actions is closely related and
separating them into multiple Actions would result in duplication of code you can use LookupDispatchAction.
LookupDispatchAction is subclass of DispatchAction.
Follow the below six steps to setup LookupDispatchAction. Step 1. In the JSP page (empdetails.jsp)
//No need method name declaration in JSP . Button name from resource bundle. Step 2. In the the Resource Bundle. //Here you can add localization.
Step 3. Adding ActionForm Entry in struts-config.xml Add the following entry in the
struts-config.xml file.
Step 4. Add action mapping in the struts-config.xml file: Add the following action mapping in the
struts-config.xml file: Step 5. In the Action class. Implement a method named getKeyMethodMap() in the subclass of the
LookupDispatchAction. The method returns a java.util.Map. The
keys used in the Map should be also used as keys in Message Resource
Bundle. Step 6. In the EmpForm Now in the browser type http://localhost:8080/jsp/empdetails.jsp
for every form submission, LookupDispatchAction does the
reverse lookup on the resource bundle to get the key and then gets the method
whose name is associated with the key from
getKeyMethodmap(). |
SCJP 6.0 Simulator 664+ Questions With Explanations
SCWCD 5.0 Simulator 556+ Questions With Explanations
SCWCD 4.0 Simulator 500+ Questions With Explanations
OCA 10g Simulator 594+ Questions With Explanations
Subscribe to PMP_FOURTH_EDITION
Subscribe to techfaq360