Java Doc for LookupDispatchAction.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » actions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 1.3.8 » org.apache.struts.actions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.struts.actions.BaseAction
   org.apache.struts.actions.DispatchAction
      org.apache.struts.actions.LookupDispatchAction

All known Subclasses:   org.apache.struts.webapp.dispatch.LookupDispatchExampleAction,
LookupDispatchAction
abstract public class LookupDispatchAction extends DispatchAction (Code)

An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping. To configure the use of this action in your struts-config.xml file, create an entry like this:

 <action path="/test"
 type="org.example.MyAction"
 name="MyForm"
 scope="request"
 input="/test.jsp"
 parameter="method"/>
 

which will use the value of the request parameter named "method" to locate the corresponding key in ApplicationResources. For example, you might have the following ApplicationResources.properties:

 button.add=Add Record
 button.delete=Delete Record
 

And your JSP would have the following format for submit buttons:

 <html:form action="/test">
 <html:submit property="method">
 <bean:message key="button.add"/>
 </html:submit>
 <html:submit property="method">
 <bean:message key="button.delete"/>
 </html:submit>
 </html:form>
 

Your subclass must implement both getKeyMethodMap and the methods defined in the map. An example of such implementations are:

 protected Map getKeyMethodMap() {
 Map map = new HashMap();
 map.put("button.add", "add");
 map.put("button.delete", "delete");
 return map;
 }
 public ActionForward add(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws IOException, ServletException {
 // do add
 return mapping.findForward("success");
 }
 public ActionForward delete(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws IOException, ServletException {
 // do delete
 return mapping.findForward("success");
 }
 

Notes - If duplicate values exist for the keys returned by getKeys, only the first one found will be returned. If no corresponding key is found then an exception will be thrown. You can override the method unspecified to provide a custom handler. If the submit was cancelled (a html:cancel button was pressed), the custom handler cancelled will be used instead.



Field Summary
protected  MapkeyMethodMap
     Resource key to method name lookup.
protected  MaplocaleMap
     Reverse lookup map from resource value to resource key.


Method Summary
public  ActionForwardexecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it).
abstract protected  MapgetKeyMethodMap()
     Provides the mapping from resource key to method name.
protected  StringgetLookupMapName(HttpServletRequest request, String keyName, ActionMapping mapping)
     Lookup the method name corresponding to the client request's locale.
protected  StringgetMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter)
     Returns the method name, given a parameter's value.

Field Detail
keyMethodMap
protected Map keyMethodMap(Code)
Resource key to method name lookup.



localeMap
protected Map localeMap(Code)
Reverse lookup map from resource value to resource key.





Method Detail
execute
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating
Parameters:
  form - The optional ActionForm bean for this request (if any) Describes where and how control should be forwarded.
throws:
  Exception - if an error occurs



getKeyMethodMap
abstract protected Map getKeyMethodMap()(Code)
Provides the mapping from resource key to method name. Resource key / method name map.



getLookupMapName
protected String getLookupMapName(HttpServletRequest request, String keyName, ActionMapping mapping) throws ServletException(Code)
Lookup the method name corresponding to the client request's locale.
Parameters:
  request - The HTTP request we are processing
Parameters:
  keyName - The parameter name to use as the properties key
Parameters:
  mapping - The ActionMapping used to select this instance The method's localized name.
throws:
  ServletException - if keyName cannot be resolved
since:
   Struts 1.2.0



getMethodName
protected String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception(Code)
Returns the method name, given a parameter's value.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (ifany)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating
Parameters:
  parameter - The ActionMapping parameter's name The method's name.
throws:
  Exception - if an error occurs
since:
   Struts 1.2.0



Fields inherited from org.apache.struts.actions.DispatchAction
protected Class clazz(Code)(Java Doc)
protected static Log log(Code)(Java Doc)
protected HashMap methods(Code)(Java Doc)
protected Class[] types(Code)(Java Doc)

Methods inherited from org.apache.struts.actions.DispatchAction
protected ActionForward cancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name) throws Exception(Code)(Java Doc)
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
protected Method getMethod(String name) throws NoSuchMethodException(Code)(Java Doc)
protected String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception(Code)(Java Doc)
protected String getParameter(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)

Fields inherited from org.apache.struts.actions.BaseAction
protected static MessageResources messages(Code)(Java Doc)


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.