Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.struts.action.ActionForm
org.apache.struts.action.DynaActionForm
ActionForm
that allows the creation
of form beans with dynamic sets of properties, without requiring the
developer to create a Java class for each type of form bean.
USAGE NOTE - Since Struts 1.1, the
reset
method no longer initializes property values to those
specified in <form-property>
elements in the Struts
module configuration file. If you wish to utilize that behavior, the
simplest solution is to subclass DynaActionForm
and call
the initialize
method inside it.
Field Summary | |
protected DynaActionFormClass |
|
protected HashMap |
|
Fields inherited from class org.apache.struts.action.ActionForm | |
multipartRequestHandler , servlet |
Method Summary | |
boolean |
|
Object |
|
Object |
|
Object |
|
DynaClass |
|
protected DynaProperty |
|
Map |
|
String |
|
String[] |
|
void |
|
void |
|
protected boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
(package private) void |
|
String |
|
Methods inherited from class org.apache.struts.action.ActionForm | |
getMultipartRequestHandler , getServlet , getServletWrapper , reset , reset , setMultipartRequestHandler , setServlet , validate , validate |
protected DynaActionFormClass dynaClass
TheDynaActionFormClass
with which we are associated.
protected HashMap dynaValues
The set of property values for thisDynaActionForm
, keyed by property name.
public boolean contains(String name, String key)
Indicates if the specified mapped property contain a value for the specified key value.
- Parameters:
name
- Name of the property to checkkey
- Name of the key to check
public Object get(String name)
Return the value of a simple property with the specified name.
- Parameters:
name
- Name of the property whose value is to be retrieved
public Object get(String name, String key)
Return the value of a mapped property with the specified name, ornull
if there is no value for the specified key.
- Parameters:
name
- Name of the property whose value is to be retrievedkey
- Key of the value to be retrieved
public Object get(String name, int index)
Return the value of an indexed property with the specified name.
- Parameters:
name
- Name of the property whose value is to be retrievedindex
- Index of the value to be retrieved
public DynaClass getDynaClass()
Return theDynaClass
instance that describes the set of properties available for thisDynaBean
.
protected DynaProperty getDynaProperty(String name)
Return the property descriptor for the specified property name.
- Parameters:
name
- Name of the property for which to retrieve the descriptor
public Map getMap()
Returns theMap
containing the property values. This is done mostly to facilitate accessing theDynaActionForm
through JavaBeans accessors, in order to use the JavaServer Pages Standard Tag Library (JSTL). For instance, the normal JSTL EL syntax for accessing anActionForm
would be something like this:${formbean.prop}The JSTL EL syntax for accessing aDynaActionForm
looks something like this (because of the presence of thisgetMap()
method):${dynabean.map.prop}
public String getString(String name)
Return the value of aString
property with the specified name. This is equivalent to calling(String) dynaForm.get(name)
.
- Parameters:
name
- Name of the property whose value is to be retrieved
- Since:
- Struts 1.2
public String[] getStrings(String name)
Return the value of aString[]
property with the specified name. This is equivalent to calling(String[]) dynaForm.get(name)
.
- Parameters:
name
- Name of the property whose value is to be retrieved
- Since:
- Struts 1.2
public void initialize(ActionMapping mapping)
Initialize all bean properties to their initial values, as specified in theFormPropertyConfig
elements associated with the definition of thisDynaActionForm
.
- Parameters:
mapping
- The mapping used to select this instance
protected boolean isDynaAssignable(Class dest, Class source)
Indicates if an object of the source class is assignable to the destination class.
- Parameters:
dest
- Destination classsource
- Source class
public void remove(String name, String key)
Remove any existing value for the specified key on the specified mapped property.
- Parameters:
name
- Name of the property for which a value is to be removedkey
- Key of the value to be removed
public void reset(ActionMapping mapping, HttpServletRequest request)
Reset bean properties to their default state, as needed. This method is called before the properties are repopulated by the controller. The default implementation (since Struts 1.1) does nothing. Subclasses may override this method to reset bean properties to default values, or theinitialize
method may be used to initialize property values to those provided in the form property configuration information (which was the behavior of this method in some release candidates).
- Overrides:
- reset in interface ActionForm
- Parameters:
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
public void reset(ActionMapping mapping, ServletRequest request)
Reset bean properties to their default state, as needed. 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.
- Overrides:
- reset in interface ActionForm
- Parameters:
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
public void set(String name, Object value)
Set the value of a simple property with the specified name.
- Parameters:
name
- Name of the property whose value is to be setvalue
- Value to which this property is to be set
public void set(String name, String key, Object value)
Set the value of a mapped property with the specified name.
- Parameters:
name
- Name of the property whose value is to be setkey
- Key of the property to be setvalue
- Value to which this property is to be set
public void set(String name, int index, Object value)
Set the value of an indexed property with the specified name.
- Parameters:
name
- Name of the property whose value is to be setindex
- Index of the property to be setvalue
- Value to which this property is to be set
(package private) void setDynaActionFormClass(DynaActionFormClass dynaClass)
Set theDynaActionFormClass
instance with which we are associated.
- Parameters:
dynaClass
- The DynaActionFormClass instance for this bean
public String toString()
Render a String representation of this object.