jp.terasoluna.fw.web.struts.form
Class DynaValidatorActionFormEx

java.lang.Object
  extended by org.apache.struts.action.ActionForm
      extended by org.apache.struts.action.DynaActionForm
          extended by org.apache.struts.validator.DynaValidatorForm
              extended by org.apache.struts.validator.DynaValidatorActionForm
                  extended by jp.terasoluna.fw.web.struts.form.DynaValidatorActionFormEx
All Implemented Interfaces:
java.io.Serializable, FormEx, org.apache.commons.beanutils.DynaBean

public class DynaValidatorActionFormEx
extends org.apache.struts.validator.DynaValidatorActionForm
implements FormEx

Dynamic action form class.

DynaValidatorActionFormEx enables to generate the action form dynamically by setting the configuration information in Struts configuration file (struts-config.xml).

Example of creating action form in Struts configuration file (struts-config.xml)

 <form-beans>
  <form-bean
  name="_validateSampleForm"
  type="jp.terasoluna.fw.web.thin.form.DynaValidatorActionFormEx">
    <form-property name="companyId" type="java.lang.String" />
    <form-property name="userId"    type="java.lang.String" />
    <form-property name="password"  type="java.lang.String" />
    <form-property name="longName"  type="java.lang.String" />
    <form-property name="codeArray" type="java.util.ArrayList" />
  </form-bean>
 </form-beans>
 
Specify form name in name attribute of <form-bean> tag and class name in the type attribute.
The uniqueness of form in the session is ensured by appending "_" in the beginning of form name and specifying RequestProcessorEx in the controller.

Functionality provided by extending this class
For the functionality related details, refer to the following:

See Also:
ValidatorActionFormEx, RequestProcessorEx, Resetter, ResetterPlugIn, FieldChecksEx, BLogicMapper, Serialized Form

Field Summary
private static org.apache.commons.logging.Log log
          Log class.
private  boolean modified
          Field value change flag.
private static long serialVersionUID
          Serial version ID
 
Fields inherited from class org.apache.struts.validator.DynaValidatorForm
page, validatorResults
 
Fields inherited from class org.apache.struts.action.DynaActionForm
dynaClass, dynaValues
 
Fields inherited from class org.apache.struts.action.ActionForm
multipartRequestHandler, servlet
 
Constructor Summary
DynaValidatorActionFormEx()
           
 
Method Summary
 java.lang.Object get(java.lang.String name, int index)
          Fetches the indexed property.
 int getIndexCount(java.lang.String fieldName)
          Fetches the record count of specified field.
 java.lang.Object getIndexedValue(java.lang.String name, int index)
          Fetches the indexed property.
 boolean isModified()
          Fetches field value change flag.
 void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Resets the field value of action form.
 void set(java.lang.String name, int index, java.lang.Object value)
          Sets the indexed property.
 void setIndexedValue(java.lang.String name, int index, java.lang.Object value)
          Sets indexed property.
 void setModified(boolean modified)
          Sets ield value change flag.
 
Methods inherited from class org.apache.struts.validator.DynaValidatorActionForm
getValidationKey
 
Methods inherited from class org.apache.struts.validator.DynaValidatorForm
getPage, getResultValueMap, getValidatorResults, setPage, setPageFromDynaProperty, setValidatorResults, validate
 
Methods inherited from class org.apache.struts.action.DynaActionForm
contains, get, get, getDynaClass, getDynaProperty, getMap, getString, getStrings, initialize, initialize, isDynaAssignable, remove, reset, set, set, toString
 
Methods inherited from class org.apache.struts.action.ActionForm
getMultipartRequestHandler, getServlet, getServletWrapper, setMultipartRequestHandler, setServlet, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.beanutils.DynaBean
contains, get, get, getDynaClass, remove, set, set
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version ID

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
Log class.


modified

private boolean modified
Field value change flag.

Constructor Detail

DynaValidatorActionFormEx

public DynaValidatorActionFormEx()
Method Detail

get

public java.lang.Object get(java.lang.String name,
                            int index)
Fetches the indexed property.

It is extended from the Struts default so that the null is returned when the index is out of scope.

Specified by:
get in interface org.apache.commons.beanutils.DynaBean
Overrides:
get in class org.apache.struts.action.DynaActionForm
Parameters:
name - Field name
index - Index
Returns:
Property value

getIndexedValue

public java.lang.Object getIndexedValue(java.lang.String name,
                                        int index)
Fetches indexed property.

It is extended from the Struts default so that the null is returned when the index is out of scope.

Specified by:
getIndexedValue in interface FormEx
Parameters:
name - Field name
index - Index
Returns:
Property value

getIndexCount

public int getIndexCount(java.lang.String fieldName)
Fetches the record count of specified field.

Specified by:
getIndexCount in interface FormEx
Parameters:
fieldName - Name of the field for fetching the records.
Returns:
Records of field value.

Returns 0 when it is not possible to fetch the property name.


reset

public void reset(org.apache.struts.action.ActionMapping mapping,
                  javax.servlet.http.HttpServletRequest request)
Resets the field value of action form

Overrides:
reset in class org.apache.struts.validator.DynaValidatorForm
Parameters:
mapping - Mapping information
request - Request information

setIndexedValue

public void setIndexedValue(java.lang.String name,
                            int index,
                            java.lang.Object value)
Sets indexed property.

In DynaActionForm of Struts, when the property type is changed to List type or array type, type need to be initialized and size need to be decided before use. However, this class is extended in such a way that this process can be skipped by dynamically changing the size.

Specified by:
setIndexedValue in interface FormEx
Parameters:
name - Field name to be set
index - Index to be set
value - Field value to be set

set

public void set(java.lang.String name,
                int index,
                java.lang.Object value)
Sets indexed property.

In DynaActionForm of Struts, when the property type is changed to List type or array type, type need to be initialized and size need to be decided before use. However, this class is extended in such a way that this process can be skipped by dynamically changing the size.

Specified by:
set in interface org.apache.commons.beanutils.DynaBean
Overrides:
set in class org.apache.struts.action.DynaActionForm
Parameters:
name - Field name to be set
index - Index to be set
value - Field value to be set

isModified

public boolean isModified()
Fetches field value change flag.

Specified by:
isModified in interface FormEx
Returns:
Field value change flag

setModified

public void setModified(boolean modified)
Sets Field value change flag.

Specified by:
setModified in interface FormEx
Parameters:
modified - Field value change flag