Java Doc for EventActionDispatcher.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) 


java.lang.Object
   org.apache.struts.actions.ActionDispatcher
      org.apache.struts.actions.EventActionDispatcher

EventActionDispatcher
public class EventActionDispatcher extends ActionDispatcher (Code)

An Action helper class that dispatches to to one of the public methods that are named in the parameter attribute of the corresponding ActionMapping and matches a submission parameter. This is useful for developers who prefer to use many submit buttons, images, or submit links on a single form and whose related actions exist in a single Action class.

The method(s) in the associated Action must have the same signature (other than method name) of the standard Action.execute method.

To configure the use of this action in your struts-config.xml file, create an entry like this:


 <action path="/saveSubscription"
 type="org.example.SubscriptionAction"
 name="subscriptionForm"
 scope="request"
 input="/subscription.jsp"
 parameter="save,back,recalc=recalculate,default=save"/>
 

where parameter contains three possible methods and one default method if nothing matches (such as the user pressing the enter key).

For utility purposes, you can use the key=value notation to alias methods so that they are exposed as different form element names, in the event of a naming conflict or otherwise. In this example, the recalc button (via a request parameter) will invoke the recalculate method. The security-minded person may find this feature valuable to obfuscate and not expose the methods.

The default key is purely optional. If this is not specified and no parameters match the list of method keys, null is returned which means the unspecified method will be invoked.

The order of the parameters are guaranteed to be iterated in the order specified. If multiple buttons were accidently submitted, the first match in the list will be dispatched.

To implement this dispatch behaviour in an Action, class create your custom Action as follows, along with the methods you require (and optionally "cancelled" and "unspecified" methods):

 public class MyCustomAction extends Action {
 protected ActionDispatcher dispatcher = new EventActionDispatcher(this);
 public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws Exception {
 return dispatcher.execute(mapping, form, request, response);
 }
 }
 


since:
   Struts 1.2.9




Constructor Summary
public  EventActionDispatcher(Action action)
     Constructs a new object for the specified action.

Method Summary
protected  StringgetMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter)
     Returns the method name, given a parameter's value.
protected  ActionForwardunspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    

Dispatches to the target class' unspecified method, if present, otherwise throws a ServletException.



Constructor Detail
EventActionDispatcher
public EventActionDispatcher(Action action)(Code)
Constructs a new object for the specified action.
Parameters:
  action - the action




Method Detail
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.



unspecified
protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)

Dispatches to the target class' unspecified method, if present, otherwise throws a ServletException. Classes utilizing EventActionDispatcher should provide an unspecified method if they wish to provide behavior different than throwing a ServletException.


Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The non-HTTP request we are processing
Parameters:
  response - The non-HTTP response we are creating The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if the application business logic throws anexception.



Fields inherited from org.apache.struts.actions.ActionDispatcher
final public static int DEFAULT_FLAVOR(Code)(Java Doc)
final public static int DISPATCH_FLAVOR(Code)(Java Doc)
final public static int MAPPING_FLAVOR(Code)(Java Doc)
protected Action actionInstance(Code)(Java Doc)
protected Class clazz(Code)(Java Doc)
protected int flavor(Code)(Java Doc)
protected static Log log(Code)(Java Doc)
protected static MessageResources messages(Code)(Java Doc)
protected HashMap methods(Code)(Java Doc)
protected Class[] types(Code)(Java Doc)

Methods inherited from org.apache.struts.actions.ActionDispatcher
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)
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name, Method method) 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 boolean isCancelled(HttpServletRequest request)(Code)(Java Doc)
protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.