Java Doc for Action.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » action » 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.action 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts.action.Action

All known Subclasses:   org.apache.struts.webapp.example.SaveRegistrationAction,  org.apache.struts.webapp.example.EditRegistrationAction,  org.apache.struts.webapp.validator.ShowFileAction,  org.apache.struts.webapp.validator.MultiRegistrationAction,  org.apache.struts.webapp.dispatch.EventActionDispatcherExample,  examples.links.ProcessLinksAction,  org.apache.struts.webapp.validator.TypeAction,  org.apache.struts.webapp.example2.EditSubscriptionAction,  examples.localization.ProcessLocalizationAction,  examples.token.ProcessTokenAction,  examples.bean.PrepareBeanAction,  org.apache.struts.webapp.example2.EditRegistrationAction,  org.apache.struts.tiles.actions.TilesAction,  org.apache.struts.webapp.example2.SaveSubscriptionAction,  org.apache.struts.webapp.example.LogonAction,  org.apache.struts.webapp.example2.LogonAction,  org.apache.struts.webapp.example2.LogoffAction,  examples.simple.ProcessSimpleAction,  org.apache.struts.webapp.example2.SaveRegistrationAction,  org.apache.struts.webapp.el.exercise.HtmlSettersAction,  org.apache.struts.webapp.exercise.HtmlSettersAction,  org.apache.struts.webapp.validator.RegistrationAction,  org.apache.struts.webapp.example.SaveSubscriptionAction,  examples.options.PrepareOptionsAction,  examples.logic.PrepareLogicAction,  org.apache.struts.webapp.exercise.ImageAction,  org.apache.struts.webapp.dispatch.ActionDispatcherExample,  examples.multibox.PrepareMultiboxAction,  org.apache.struts.tiles.actions.DefinitionDispatcherAction,  org.apache.struts.tiles.actions.ReloadDefinitionsAction,  examples.options.ProcessOptionsAction,  examples.multibox.ProcessMultiboxAction,  org.apache.struts.webapp.example.EditSubscriptionAction,  examples.dyna.ProcessDynaAction,  examples.validator.ProcessValidatorAction,  org.apache.struts.actions.BaseAction,  org.apache.struts.webapp.validator.LocaleAction,  org.apache.struts.webapp.upload.UploadAction,  examples.token.PrepareTokenAction,  org.apache.struts.webapp.el.exercise.DynaSetAction,  org.apache.struts.scripting.ScriptAction,  examples.links.PrepareLinksAction,  examples.SuccessAction,  org.apache.struts.webapp.exercise.SuccessAction,  org.apache.struts.webapp.example.LogoffAction,  org.apache.struts.webapp.validator.EditTypeAction,  org.apache.struts.tiles.actions.ViewDefinitionsAction,  org.apache.struts.mock.MockAction,
Action
public class Action (Code)

An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller (RequestProcessor) will select an appropriate Action for each request, create an instance (if necessary), and call the execute method.

Actions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. This means you should design with the following items in mind:

  • Instance and static variables MUST NOT be used to store information related to the state of a particular request. They MAY be used to share global resources across requests for the same action.
  • Access to other resources (JavaBeans, session variables, etc.) MUST be synchronized if those resources require protection. (Generally, however, resource classes should be designed to provide their own protection where necessary.

When an Action instance is first created, the controller will call setServlet with a non-null argument to identify the servlet instance to which this Action is attached. When the servlet is to be shut down (or restarted), the setServlet method will be called with a null argument, which can be used to clean up any allocated resources in use by this Action.


version:
   $Rev: 471754 $ $Date: 2005-08-26 21:58:39 -0400 (Fri, 26 Aug 2005)
version:
   $


Field Summary
protected transient  ActionServletservlet
    


Method Summary
protected  voidaddErrors(HttpServletRequest request, ActionMessages errors)
     Adds the specified errors keys into the appropriate request attribute for use by the <html:errors> tag, if any messages are required. Initialize the attribute if it has not already been.
protected  voidaddMessages(HttpServletRequest request, ActionMessages messages)
     Adds the specified messages keys into the appropriate request attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required.
public  ActionForwardexecute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response)
    

Process the specified non-HTTP request, and create the corresponding non-HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic.

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), with provision for handling exceptions thrown by the business logic.

protected  StringgenerateToken(HttpServletRequest request)
    
protected  ActionMessagesgetErrors(HttpServletRequest request)
     Retrieves any existing errors placed in the request by previous actions.
protected  LocalegetLocale(HttpServletRequest request)
    
protected  ActionMessagesgetMessages(HttpServletRequest request)
    

Retrieves any existing messages placed in the request by previous actions.

protected  MessageResourcesgetResources(HttpServletRequest request)
    
protected  MessageResourcesgetResources(HttpServletRequest request, String key)
    

Return the specified message resources for the current module.


Parameters:
  request - The servlet request we are processing
Parameters:
  key - The key specified in the message-resources element forthe requested bundle.
public  ActionServletgetServlet()
    
protected  booleanisCancelled(HttpServletRequest request)
    

Returns true if the current form's cancel button was pressed.

protected  booleanisTokenValid(HttpServletRequest request)
    

Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.

protected  booleanisTokenValid(HttpServletRequest request, boolean reset)
    

Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.

protected  voidresetToken(HttpServletRequest request)
    

Reset the saved transaction token in the user's session.

protected  voidsaveErrors(HttpServletRequest request, ActionMessages errors)
    

Save the specified error messages keys into the appropriate request attribute for use by the <html:errors> tag, if any messages are required.

protected  voidsaveErrors(HttpSession session, ActionMessages errors)
    

Save the specified error messages keys into the appropriate session attribute for use by the <html:messages> tag (if messages="false") or <html:errors>, if any error messages are required.

protected  voidsaveMessages(HttpServletRequest request, ActionMessages messages)
    

Save the specified messages keys into the appropriate request attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required.

protected  voidsaveMessages(HttpSession session, ActionMessages messages)
    

Save the specified messages keys into the appropriate session attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required.

protected  voidsaveToken(HttpServletRequest request)
    
protected  voidsetLocale(HttpServletRequest request, Locale locale)
    
public  voidsetServlet(ActionServlet servlet)
    

Field Detail
servlet
protected transient ActionServlet servlet(Code)

The servlet to which we are attached.






Method Detail
addErrors
protected void addErrors(HttpServletRequest request, ActionMessages errors)(Code)
Adds the specified errors keys into the appropriate request attribute for use by the <html:errors> tag, if any messages are required. Initialize the attribute if it has not already been. Otherwise, ensure that the request attribute is not set.
Parameters:
  request - The servlet request we are processing
Parameters:
  errors - Errors object
since:
   Struts 1.2.1



addMessages
protected void addMessages(HttpServletRequest request, ActionMessages messages)(Code)
Adds the specified messages keys into the appropriate request attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required. Initialize the attribute if it has not already been. Otherwise, ensure that the request attribute is not set.
Parameters:
  request - The servlet request we are processing
Parameters:
  messages - Messages object
since:
   Struts 1.2.1



execute
public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception(Code)

Process the specified non-HTTP request, and create the corresponding non-HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic. Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.

The default implementation attempts to forward to the HTTP version of this method.


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.
since:
   Struts 1.1



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), with provision for handling exceptions thrown by the business logic. 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:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The 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
since:
   Struts 1.1



generateToken
protected String generateToken(HttpServletRequest request)(Code)

Generate a new transaction token, to be used for enforcing a single request for a particular transaction.


Parameters:
  request - The request we are processing The new transaction token.



getErrors
protected ActionMessages getErrors(HttpServletRequest request)(Code)
Retrieves any existing errors placed in the request by previous actions. This method could be called instead of creating a new ActionMessages() at the beginning of an Action. This will prevent saveErrors() from wiping out any existing Errors
Parameters:
  request - The servlet request we are processing the Errors that already exist in the request, or a newActionMessages object if empty.
since:
   Struts 1.2.1



getLocale
protected Locale getLocale(HttpServletRequest request)(Code)

Return the user's currently selected Locale.


Parameters:
  request - The request we are processing The user's currently selected Locale.



getMessages
protected ActionMessages getMessages(HttpServletRequest request)(Code)

Retrieves any existing messages placed in the request by previous actions. This method could be called instead of creating a new ActionMessages() at the beginning of an Action This will prevent saveMessages() from wiping out any existing Messages


Parameters:
  request - The servlet request we are processing the Messages that already exist in the request, or a newActionMessages object if empty.
since:
   Struts 1.2.1



getResources
protected MessageResources getResources(HttpServletRequest request)(Code)

Return the default message resources for the current module.


Parameters:
  request - The servlet request we are processing The default message resources for the current module.
since:
   Struts 1.1



getResources
protected MessageResources getResources(HttpServletRequest request, String key)(Code)

Return the specified message resources for the current module.


Parameters:
  request - The servlet request we are processing
Parameters:
  key - The key specified in the message-resources element forthe requested bundle. The specified message resource for the current module.
since:
   Struts 1.1



getServlet
public ActionServlet getServlet()(Code)

Return the servlet instance to which we are attached.

The servlet instance to which we are attached.



isCancelled
protected boolean isCancelled(HttpServletRequest request)(Code)

Returns true if the current form's cancel button was pressed. This method will check if the Globals.CANCEL_KEY request attribute has been set, which normally occurs if the cancel button generated by CancelTag was pressed by the user in the current request. If true, validation performed by an ActionForm's validate() method will have been skipped by the controller servlet.

Since Action 1.3.0, the mapping for a cancellable Action must also have the new "cancellable" property set to true. If "cancellable" is not set, and the magic Cancel token is found in the request, the standard Composable Request Processor will throw an InvalidCancelException.


Parameters:
  request - The servlet request we are processing true if the cancel button was pressed;false otherwise.



isTokenValid
protected boolean isTokenValid(HttpServletRequest request)(Code)

Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it. Returns false under any of the following circumstances:

  • No session associated with this request
  • No transaction token saved in the session
  • No transaction token included as a request parameter
  • The included transaction token value does not match the transaction token in the user's session

Parameters:
  request - The servlet request we are processing true if there is a transaction token and it isvalid; false otherwise.



isTokenValid
protected boolean isTokenValid(HttpServletRequest request, boolean reset)(Code)

Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it. Returns false under any of the following circumstances:

  • No session associated with this request
  • No transaction token saved in the session
  • No transaction token included as a request parameter
  • The included transaction token value does not match the transaction token in the user's session

Parameters:
  request - The servlet request we are processing
Parameters:
  reset - Should we reset the token after checking it? true if there is a transaction token and it isvalid; false otherwise.



resetToken
protected void resetToken(HttpServletRequest request)(Code)

Reset the saved transaction token in the user's session. This indicates that transactional token checking will not be needed on the next request that is submitted.


Parameters:
  request - The servlet request we are processing



saveErrors
protected void saveErrors(HttpServletRequest request, ActionMessages errors)(Code)

Save the specified error messages keys into the appropriate request attribute for use by the <html:errors> tag, if any messages are required. Otherwise, ensure that the request attribute is not created.


Parameters:
  request - The servlet request we are processing
Parameters:
  errors - Error messages object
since:
   Struts 1.2



saveErrors
protected void saveErrors(HttpSession session, ActionMessages errors)(Code)

Save the specified error messages keys into the appropriate session attribute for use by the <html:messages> tag (if messages="false") or <html:errors>, if any error messages are required. Otherwise, ensure that the session attribute is empty.


Parameters:
  session - The session to save the error messages in.
Parameters:
  errors - The error messages to save. null or emptymessages removes any existing error ActionMessages inthe session.
since:
   Struts 1.3



saveMessages
protected void saveMessages(HttpServletRequest request, ActionMessages messages)(Code)

Save the specified messages keys into the appropriate request attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required. Otherwise, ensure that the request attribute is not created.


Parameters:
  request - The servlet request we are processing.
Parameters:
  messages - The messages to save. null or emptymessages removes any existing ActionMessages in therequest.
since:
   Struts 1.1



saveMessages
protected void saveMessages(HttpSession session, ActionMessages messages)(Code)

Save the specified messages keys into the appropriate session attribute for use by the <html:messages> tag (if messages="true" is set), if any messages are required. Otherwise, ensure that the session attribute is not created.


Parameters:
  session - The session to save the messages in.
Parameters:
  messages - The messages to save. null or emptymessages removes any existing ActionMessages in thesession.
since:
   Struts 1.2



saveToken
protected void saveToken(HttpServletRequest request)(Code)

Save a new transaction token in the user's current session, creating a new session if necessary.


Parameters:
  request - The servlet request we are processing



setLocale
protected void setLocale(HttpServletRequest request, Locale locale)(Code)

Set the user's currently selected Locale into their HttpSession.


Parameters:
  request - The request we are processing
Parameters:
  locale - The user's selected Locale to be set, or null to selectthe server's default Locale



setServlet
public void setServlet(ActionServlet servlet)(Code)

Set the servlet instance to which we are attached (if servlet is non-null), or release any allocated resources (if servlet is null).


Parameters:
  servlet - The new controller servlet, if any



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.