|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.terasoluna.fw.web.struts.reset.ResetterImpl
public class ResetterImpl
Default reset implementation class.
It is the Resetter implementation class which is provided in TERASOLUNA by default.
This class uses
ResetterPlugIn
and resets the form field based on the information which is set in XML file.
Since the reset() method of action form is extended, reset process is executed only in Struts lifecycle.
Since the purpose of reset process is to initialize the property that contains the checkbox and
radio button value, its usage for any other purpose is not assured.
*To initialize the field, change the value of model by using the business logic.
In Struts lifecycle, the respective property can be rewritten again
in the request parameter after performing reset.
In reset process, type cannot be identified when the value of target field is null.
In case of Null, the value cannot be changed. Object type field other than null
should be initialized to null value, boolean type should be initialized to false and
other primitive type fields to 0.
At the time of using DynaValidatorActionFormEx, please note that the field is not reset to the
default value specified in struts-config.xml.
There are two reset functions, namely "Normal reset function" and "Specified range reset function"
In "specified range reset function", any range can be reset for array or List object.
Any range to be reset should be stored in the request parameter by using "startIndex"
and "endIndex" as key.
<reset>
<action path="/resetAction">
<property-reset name="field1" />
<property-reset name="field2" select="true" />
</action>
</reset>
If above settings are performed and /resetAction.do is invoked,
specified field of the form is cleared before reflecting the request parameter to the form.
public class MyActionForm extends ValidatorActionFormEx {
private List rows = null;
public void setRows(List rows) {
this.rows = rows;
}
public List getRows() {
return this.rows;
}
private Map map = new HashMap();
//Omit the following
}
public class Row {
private String value = null;
public void setValue(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}
MyActionForm class contains the list of Row class.
In order to reset the value of key "field" of map property of
type Map and value of property named "value" of Row class,
see the following example of reset.xml.
<reset>
<action path="/resetAction">
<property-reset name="rows.value" />
<property-reset name="map(field)" />
</action>
</reset>
In multiple reference format, only property name is described.
Framework automatically recognizes the array or List element and resets all the elements.
Same as the normal property, reset can be performed for specified range by specifying true in
select attribute.
ResetterPlugIn
,
ActionReset
,
FieldReset
,
ResetterResources
,
FormEx
,
DynaValidatorActionFormEx
,
ValidatorActionFormEx
Field Summary | |
---|---|
private static org.apache.commons.logging.Log |
log
Log class |
Fields inherited from interface jp.terasoluna.fw.web.struts.reset.Resetter |
---|
RESETTER_KEY |
Constructor Summary | |
---|---|
ResetterImpl()
|
Method Summary | |
---|---|
protected ActionReset |
getActionReset(org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Fetches the instance of ActionReset which is linked with action path. |
protected ResetterResources |
getResetterResources(javax.servlet.http.HttpServletRequest request)
Fetches the instance of ResetterResources . |
void |
reset(FormEx form,
org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Reset the field value of form. |
protected void |
resetSelectField(FormEx form,
java.util.Map<java.lang.String,java.lang.Object> propMap,
javax.servlet.http.HttpServletRequest request)
Resets the selected field. When "true" is set in select attribute, the field value of the index which is specified from "startIndex" ~ "endIndex" of request parameter, should be initialized to null. When the request parameter does not include "startIndex", "endIndex", all elements are reset. When the field value type is declared as array or List type, normal reset process is performed. |
protected void |
resetValue(FormEx form,
java.util.Map.Entry<java.lang.String,java.lang.Object> entry)
Resets the specified property of action form. Set false when property type is boolean or Boolean type. For other primitive type and their wrapper type, set 0. When property type is the Object type other than wrapper type, set null. Entry argument cannot be passed as null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
Constructor Detail |
---|
public ResetterImpl()
Method Detail |
---|
public void reset(FormEx form, org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
reset
in interface Resetter
form
- Action formmapping
- Mapping informationrequest
- Request informationResetterPlugIn
,
ActionReset
,
FieldReset
,
ResetterResources
,
FormEx
,
DynaValidatorActionFormEx
,
ValidatorActionFormEx
protected void resetValue(FormEx form, java.util.Map.Entry<java.lang.String,java.lang.Object> entry)
form
- Action form which is used in current requestentry
- Property name to be reset and entry of current value
jp.terasoluna.fw.util.PropertyAccessException
- When failed to set the property value.protected ResetterResources getResetterResources(javax.servlet.http.HttpServletRequest request)
request
- Request information
ActionReset
,
FieldReset
protected ActionReset getActionReset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
mapping
- Mapping information of current requestrequest
- Request information
FieldReset
,
ResetterResources
protected void resetSelectField(FormEx form, java.util.Map<java.lang.String,java.lang.Object> propMap, javax.servlet.http.HttpServletRequest request)
form
- Action form which is used in current requestpropMap
- Map of property name and current valuerequest
- Request informationActionReset
,
FieldReset
,
ResetterResources
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |