public class Action extends Object
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:
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.
org.apache.struts.action.Action
コンストラクタと説明 |
---|
Action() |
修飾子とタイプ | メソッドと説明 |
---|---|
protected ActionMappingTool |
createStrutsMapping(nablarch.fw.web.HttpRequest nabHttpRequest,
nablarch.fw.ExecutionContext context) |
protected javax.servlet.http.HttpServletRequest |
createStrutsRequest(nablarch.fw.ExecutionContext context) |
protected javax.servlet.http.HttpServletResponse |
createStrutsResponse(nablarch.fw.ExecutionContext context) |
protected boolean |
isCancelled(javax.servlet.http.HttpServletRequest request)
Returns
true if the current form's cancel button was
pressed. |
protected void |
saveErrors(javax.servlet.http.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 void |
saveErrors(javax.servlet.http.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 void |
saveMessages(javax.servlet.http.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 ActionMappingTool createStrutsMapping(nablarch.fw.web.HttpRequest nabHttpRequest, nablarch.fw.ExecutionContext context)
protected javax.servlet.http.HttpServletResponse createStrutsResponse(nablarch.fw.ExecutionContext context)
protected javax.servlet.http.HttpServletRequest createStrutsRequest(nablarch.fw.ExecutionContext context)
protected boolean isCancelled(javax.servlet.http.HttpServletRequest request)
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.
request
- The servlet request we are processingtrue
if the cancel button was pressed;
false
otherwise.protected void saveMessages(javax.servlet.http.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. Otherwise, ensure that the request attribute is not created.
request
- The servlet request we are processing.messages
- The messages to save. null
or empty
messages removes any existing ActionMessages in the
request.protected void saveErrors(javax.servlet.http.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. Otherwise, ensure that the request attribute is not created.
request
- The servlet request we are processingerrors
- Error messages objectprotected void saveErrors(javax.servlet.http.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. Otherwise, ensure that the session attribute is empty.
session
- The session to save the error messages in.errors
- The error messages to save. null
or empty
messages removes any existing error ActionMessages in
the session.