|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts.action.ActionForm
An ActionForm is a JavaBean optionally associated with
one or more ActionMappings
. Such a bean will have had its
properties initialized from the corresponding request parameters before
the corresponding Action.execute
method is called.
When the properties of this bean have been populated, but before the
execute
method of the Action
is called, this bean's
validate
method will be called, which gives the bean a chance
to verify that the properties submitted by the user are correct and valid.
If this method finds problems, it returns an error messages object that
encapsulates those problems, and the controller servlet will return control
to the corresponding input form. Otherwise, the validate
method returns null
, indicating that everything is acceptable
and the corresponding Action.execute
method should be
called.
This class must be subclassed in order to be instantiated. Subclasses should provide property getter and setter methods for all of the bean properties they wish to expose, plus override any of the public or protected methods for which they wish to provide modified functionality.
Because ActionForms are JavaBeans, subclasses should also implement
Serializable
, as required by the JavaBean specification.
Some containers require that an object meet all JavaBean requirements
in order to use the introspection API upon which ActionForms rely.
Field Summary | |
protected MultipartRequestHandler |
multipartRequestHandler
The MultipartRequestHandler for this form, can be null . |
protected ActionServlet |
servlet
The servlet instance to which we are attached. |
Constructor Summary | |
ActionForm()
|
Method Summary | |
MultipartRequestHandler |
getMultipartRequestHandler()
Return the MultipartRequestHandler for this form
The reasoning behind this is to give form bean developers
control over the lifecycle of their multipart requests
through the use of the finish and/or rollback
methods of MultipartRequestHandler . |
protected ActionServlet |
getServlet()
Return the servlet instance to which we are attached. |
ActionServletWrapper |
getServletWrapper()
Return the controller servlet instance to which we are attached. |
void |
reset(ActionMapping mapping,
ServletRequest request)
Reset all bean properties to their default state. |
void |
setMultipartRequestHandler(MultipartRequestHandler multipartRequestHandler)
Set the Handler provides to use in dealing with file uploads. |
void |
setServlet(ActionServlet servlet)
Set the servlet instance to which we are attached (if servlet is non-null), or release any allocated resources
(if servlet is null). |
ActionErrors |
validate(ActionMapping mapping,
ServletRequest request)
Validate the properties that have been set for this non-HTTP request, and return an ActionErrors object that encapsulates any
validation errors that have been found. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient ActionServlet servlet
The servlet instance to which we are attached.
protected transient MultipartRequestHandler multipartRequestHandler
The MultipartRequestHandler for this form, can be
null
.
Constructor Detail |
public ActionForm()
Method Detail |
protected ActionServlet getServlet()
Return the servlet instance to which we are attached.
public ActionServletWrapper getServletWrapper()
Return the controller servlet instance to which we are attached.
as an ActionServletWrapper
.
ActionServletWrapper
public MultipartRequestHandler getMultipartRequestHandler()
Return the MultipartRequestHandler
for this form
The reasoning behind this is to give form bean developers
control over the lifecycle of their multipart requests
through the use of the finish
and/or rollback
methods of MultipartRequestHandler
. This method will return
null
if this form's enctype is not
"multipart/request-data".
MultipartRequestHandler
public void setServlet(ActionServlet servlet)
Set the servlet instance to which we are attached (if
servlet
is non-null), or release any allocated resources
(if servlet
is null).
servlet
- The new controller servlet, if anypublic void setMultipartRequestHandler(MultipartRequestHandler multipartRequestHandler)
Set the Handler provides to use in dealing with file uploads.
multipartRequestHandler
- The Handler to use for fileuploads.public void reset(ActionMapping mapping, ServletRequest request)
Reset all bean properties to their default state. This method is called before the properties are repopulated by the controller.
The default implementation attempts to forward to the HTTP version of this method.
mapping
- The mapping used to select this instancerequest
- The servlet request we are processingpublic ActionErrors validate(ActionMapping mapping, ServletRequest request)
Validate the properties that have been set for this non-HTTP request,
and return an ActionErrors
object that encapsulates any
validation errors that have been found. If no errors are found, return
null
or an ActionErrors
object with no
recorded error messages.
The default implementation attempts to forward to the HTTP version of this method.
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |