Author: rich
Date: Tue Jan 25 16:11:49 2005
New Revision: 126448
URL: http://svn.apache.org/viewcvs?view=rev&rev=126448
Log:
- Improved the integration with ValidatorPlugIn by allowing multiple
@Jpf.ValidateCustom annotations (which use custom rules defined in the user's
Validator config files) on a property. I've added an example of using custom
rules in annotations, at test/webapps/drt/validation/custom.
- Fixed to evaluate message arguments (e.g., '{0}', '{1}') in validation
messages that are evaluated from expressions (like those in the 'message'
attribute of @Jpf.Validate* annotations, or those obtained in
org.apache.beehive.netui.pageflow.ExpressionMessage).
- Deprecated all the various addValidationError() methods in FlowController and
PageFlowUtils, and had them point to an addActionMessage() that takes varargs
for the list of message arguments. Also changed addValidationErrorExpression()
to addActionErrorExpression(), and gave it a vararg list of message arguments.
- Changed to allow the @Jpf.ValidateRange annotation to accept longs instead of
ints for the range.
DRT/BVT: netui (WinXP)
BB: self (linux)
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/Controller.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/customrules.xml
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/success.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateCustom.xml
(contents, props changed)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Tue Jan 25 16:11:49 2005
@@ -191,6 +191,12 @@
return value != null ? ( Integer ) value.getValue() : ( defaultIsNull
? null : new Integer( 0 ) );
}
+ public static Long getLong( AnnotationMirror annotation, String
memberName, boolean defaultIsNull )
+ {
+ AnnotationValue value = getAnnotationValue( annotation, memberName,
defaultIsNull );
+ return value != null ? ( Long ) value.getValue() : ( defaultIsNull ?
null : new Long( 0 ) );
+ }
+
public static Float getFloat( AnnotationMirror annotation, String
memberName, boolean defaultIsNull )
{
AnnotationValue value = getAnnotationValue( annotation, memberName,
defaultIsNull );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Tue Jan 25 16:11:49 2005
@@ -54,7 +54,7 @@
public static final String VALIDATE_DATE_TAG_NAME = "ValidateDate";
public static final String VALIDATE_TYPE_TAG_NAME = "ValidateType";
public static final String VALIDATE_VALID_WHEN_TAG_NAME =
"ValidateValidWhen";
- public static final String VALIDATE_CUSTOM_TAG_NAME = "ValidateCustom";
+ public static final String VALIDATE_CUSTOM_TAG_NAME = "ValidateCustomRule";
public static final String BEGIN_ACTION_NAME = "begin";
public static final String JPF_FILE_EXTENSION = "jpf";
@@ -101,6 +101,7 @@
public static final String LONGLIVED_ATTR = "longLived";
public static final String STRUTSMERGE_ATTR = "strutsMerge";
public static final String VALIDATOR_MERGE_ATTR = "validatorMerge";
+ public static final String CUSTOM_VALIDATOR_CONFIGS_ATTR =
"customValidatorConfigs";
public static final String TILES_DEFINITIONS_CONFIGS_ATTR =
"tilesDefinitionsConfigs";
public static final String LOGIN_REQUIRED_ATTR = "loginRequired";
public static final String ROLES_ALLOWED_ATTR = "rolesAllowed";
@@ -153,7 +154,7 @@
public static final String VALIDATE_DATE_ATTR = "validateDate";
public static final String VALIDATE_TYPE_ATTR = "validateType";
public static final String VALIDATE_VALID_WHEN_ATTR = "validateValidWhen";
- public static final String VALIDATE_CUSTOM_ATTR = "validateCustom";
+ public static final String VALIDATE_CUSTOM_ATTR = "validateCustomRules";
public static final String VALIDATABLE_PROPERTIES_ATTR =
"validatableProperties";
public static final String DEFAULT_MESSAGE_RESOURCES_ATTR =
"messageBundle";
public static final String APPLY_TO_UNHANDLED_LOCALES_ATTR =
"applyToUnhandledLocales";
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Tue Jan 25 16:11:49 2005
@@ -36,6 +36,7 @@
private boolean _nested;
private boolean _longLived;
private List< String > _rolesAllowed;
+ private List< String > _customValidatorConfigs;
private boolean _loginRequired;
private boolean _readOnly;
private LinkedHashMap< String, AnnotationMirror > _forwards = new
LinkedHashMap< String, AnnotationMirror >();
@@ -72,6 +73,8 @@
if ( readOnly != null ) _readOnly = readOnly;
_rolesAllowed = mergeStringArray( _rolesAllowed, controllerAnnotation,
ROLES_ALLOWED_ATTR );
+ _customValidatorConfigs =
+ mergeStringArray( _customValidatorConfigs,
controllerAnnotation, CUSTOM_VALIDATOR_CONFIGS_ATTR );
_tilesDefsConfigs = mergeStringArray( _tilesDefsConfigs,
controllerAnnotation, TILES_DEFINITIONS_CONFIGS_ATTR );
mergeAnnotationArray( _forwards, controllerAnnotation, FORWARDS_ATTR,
NAME_ATTR );
mergeAnnotationArray( _sharedFlowRefs, controllerAnnotation,
SHARED_FLOW_REFS_ATTR, NAME_ATTR );
@@ -143,6 +146,11 @@
public List< String > getRolesAllowed()
{
return _rolesAllowed;
+ }
+
+ public List< String > getCustomValidatorConfigs()
+ {
+ return _customValidatorConfigs;
}
public boolean isLoginRequired()
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/DefaultValidatorRuleFactory.java
Tue Jan 25 16:11:49 2005
@@ -70,11 +70,11 @@
}
else
{
- Integer minInt = CompilerUtils.getInteger( ruleAnnotation,
MIN_INT_ATTR, true );
- Integer maxInt = CompilerUtils.getInteger( ruleAnnotation,
MAX_INT_ATTR, true );
- assert minInt != null; // checker should catch this
- assert maxInt != null; // checker should catch this
- rule = new ValidatorRuleRange( minInt, maxInt );
+ Long minLong = CompilerUtils.getLong( ruleAnnotation,
MIN_INT_ATTR, true );
+ Long maxLong = CompilerUtils.getLong( ruleAnnotation,
MAX_INT_ATTR, true );
+ assert minLong != null; // checker should catch this
+ assert maxLong != null; // checker should catch this
+ rule = new ValidatorRuleRange( minLong, maxLong );
}
}
else if ( annName.equals( VALIDATE_MIN_LENGTH_TAG_NAME ) )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
Tue Jan 25 16:11:49 2005
@@ -111,6 +111,7 @@
GenExceptionModel.addCatches( mca.getCatches(), this, _jclass,
this, this );
addTilesDefinitionsConfigs( mca.getTilesDefinitionsConfigs() );
+ setAdditionalValidatorConfigs( mca.getCustomValidatorConfigs() );
addActionMethods();
addFormBeans( _jclass );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
Tue Jan 25 16:11:49 2005
@@ -38,6 +38,7 @@
import java.util.Locale;
import java.util.Collection;
import java.util.Map;
+import java.util.List;
import java.io.File;
import java.io.PrintStream;
import java.io.FileOutputStream;
@@ -272,24 +273,39 @@
if ( val instanceof AnnotationMirror )
{
- AnnotationMirror annotationVal = ( AnnotationMirror ) val;
- ValidatorRule rule = getFieldRule( ruleInfo.getEntityName(),
ruleInfo.getFieldName(), annotationVal );
+ addFieldRuleFromAnnotation( ruleInfo, ( AnnotationMirror )
val, locale, applyToAllLocales );
+ }
+ else if ( val instanceof List )
+ {
+ List< AnnotationMirror > annotations =
CompilerUtils.getAnnotationArray( entry.getValue() );
- if ( rule != null )
+ for ( AnnotationMirror i : annotations )
{
- if ( applyToAllLocales )
- {
- addFieldRuleForAllLocales( ruleInfo, rule );
- }
- else
- {
- addFieldRule( ruleInfo, rule, locale );
- }
+ addFieldRuleFromAnnotation( ruleInfo, i, locale,
applyToAllLocales );
}
}
}
setEmpty( false ); // this ValidationModel is only "empty" if there
are no rules.
+ }
+
+ private void addFieldRuleFromAnnotation( RuleInfo ruleInfo,
AnnotationMirror annotation, Locale locale,
+ boolean applyToAllLocales )
+ {
+
+ ValidatorRule rule = getFieldRule( ruleInfo.getEntityName(),
ruleInfo.getFieldName(), annotation );
+
+ if ( rule != null )
+ {
+ if ( applyToAllLocales )
+ {
+ addFieldRuleForAllLocales( ruleInfo, rule );
+ }
+ else
+ {
+ addFieldRule( ruleInfo, rule, locale );
+ }
+ }
}
private ValidatorRule getFieldRule( String entityName, String
propertyName, AnnotationMirror ruleAnnotation )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
Tue Jan 25 16:11:49 2005
@@ -28,18 +28,6 @@
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.MemberDeclaration;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_REQUIRED_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_RANGE_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_MIN_LENGTH_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_MAX_LENGTH_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_CREDIT_CARD_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_EMAIL_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_MASK_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_DATE_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_TYPE_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_VALID_WHEN_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATE_CUSTOM_ATTR;
-import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VERSION_9_0_STRING;
import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.LANGUAGE_ATTR;
import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.COUNTRY_ATTR;
import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.VARIANT_ATTR;
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java
Tue Jan 25 16:11:49 2005
@@ -42,7 +42,7 @@
addMemberGrammar( VALIDATE_MASK_ATTR, new BaseValidationRuleGrammar(
env, diags, rvc ) );
addMemberGrammar( VALIDATE_DATE_ATTR, new BaseValidationRuleGrammar(
env, diags, rvc ) );
addMemberGrammar( VALIDATE_TYPE_ATTR, new ValidateTypeGrammar( env,
diags, rvc ) );
- addMemberGrammar( VALIDATE_CUSTOM_ATTR, new ValidateCustomGrammar(
env, diags, rvc ) );
addMemberGrammar( VALIDATE_VALID_WHEN_ATTR, new
ValidateValidWhenGrammar( env, diags, rvc ) );
+ addMemberArrayGrammar( VALIDATE_CUSTOM_ATTR, new
ValidateCustomGrammar( env, diags, rvc ) );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
Tue Jan 25 16:11:49 2005
@@ -53,6 +53,7 @@
private ArrayList< MessageResourcesModel > _messageResources = new
ArrayList< MessageResourcesModel >();
private HashMap< String, FormBeanModel > _formBeans = new HashMap< String,
FormBeanModel >();
private ValidationModel _validationModel;
+ private List< String > _additionalValidatorConfigs;
private boolean _returnToPageDisabled = true;
private boolean _returnToActionDisabled = true;
@@ -407,6 +408,14 @@
_returnToActionDisabled = disabled;
}
+ public void setAdditionalValidatorConfigs( List< String >
additionalValidatorConfigs )
+ {
+ if ( additionalValidatorConfigs != null && !
additionalValidatorConfigs.isEmpty() )
+ {
+ _additionalValidatorConfigs = additionalValidatorConfigs;
+ }
+ }
+
public void setValidationModel( ValidationModel validationModel )
{
if ( ! validationModel.isEmpty() ) // if there's nothing in the
validation model, we don't care about it.
@@ -739,7 +748,7 @@
protected void writeValidatorInit( StrutsConfigDocument.StrutsConfig
scElement )
{
- if ( _validationModel != null && ! _validationModel.isEmpty() )
+ if ( ( _validationModel != null && ! _validationModel.isEmpty() ) ||
_additionalValidatorConfigs != null )
{
PlugInDocument.PlugIn plugInElementToEdit = null;
PlugInDocument.PlugIn[] existingPlugIns =
scElement.getPlugInArray();
@@ -778,9 +787,22 @@
SetPropertyDocument.SetProperty pathnamesProperty =
plugInElementToEdit.addNewSetProperty();
pathnamesProperty.setProperty( VALIDATOR_PATHNAMES_PROPERTY );
StringBuilder pathNames = new StringBuilder();
- pathNames.append( NETUI_VALIDATOR_RULES_URI ).append( ',' );
- pathNames.append( STRUTS_VALIDATOR_RULES_URI ).append( ',' );
- pathNames.append( _validationModel.getOutputFileURI() );
+ pathNames.append( NETUI_VALIDATOR_RULES_URI );
+ pathNames.append( ',' ).append( STRUTS_VALIDATOR_RULES_URI );
+
+ if ( _validationModel != null && ! _validationModel.isEmpty() )
+ {
+ pathNames.append( ',' ).append(
_validationModel.getOutputFileURI() );
+ }
+
+ if ( _additionalValidatorConfigs != null )
+ {
+ for ( String configFile : _additionalValidatorConfigs )
+ {
+ pathNames.append( ',' ).append( configFile );
+ }
+ }
+
pathnamesProperty.setValue( pathNames.toString() );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorConstants.java
Tue Jan 25 16:11:49 2005
@@ -19,7 +19,7 @@
public interface ValidatorConstants
{
- String RULENAME_INT_RANGE = "intRange";
+ String RULENAME_INT_RANGE = "netui_longRange";
String RULENAME_FLOAT_RANGE = "floatRange";
String RULENAME_REQUIRED = "required";
String RULENAME_EMAIL = "email";
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java&r1=126447&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatorRuleRange.java
Tue Jan 25 16:11:49 2005
@@ -28,7 +28,7 @@
setVar( VARNAME_MAX, max.toString() );
}
- public ValidatorRuleRange( Integer min, Integer max )
+ public ValidatorRuleRange( Long min, Long max )
{
super( RULENAME_INT_RANGE );
setVar( VARNAME_MIN, min.toString() );
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ExpressionMessage.java
Tue Jan 25 16:11:49 2005
@@ -23,9 +23,9 @@
public class ExpressionMessage
extends ActionMessage
{
- public ExpressionMessage( String expression )
+ public ExpressionMessage( String expression, Object ... messageArgs )
{
- super( InternalConstants.MESSAGE_IS_EXPRESSION_PREFIX + expression );
+ super( InternalConstants.MESSAGE_IS_EXPRESSION_PREFIX + expression,
messageArgs );
}
public void setExpression( String expression )
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
Tue Jan 25 16:11:49 2005
@@ -39,6 +39,7 @@
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.RequestProcessor;
+import org.apache.struts.action.ActionMessage;
import org.apache.struts.config.ActionConfig;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.config.ControllerConfig;
@@ -1396,39 +1397,54 @@
}
/**
- * Add a validation error that will be shown with the Errors and Error
tags.
+ * Add a property-related message that will be shown with the Errors and
Error tags.
*
* @param propertyName the name of the property with which to associate
this error.
- * @param messageKey the message-resources key for the error message.
- * @param messageArgs an array of arguments for the error message.
+ * @param messageKey the message-resources key for the message.
+ * @param messageArgs zero or more arguments to the message.
*/
- protected void addValidationError( String propertyName, String messageKey,
Object[] messageArgs )
+ public void addActionMessage( String propertyName, String messageKey,
Object ... messageArgs )
{
- PageFlowUtils.addValidationError( propertyName, messageKey,
messageArgs, getRequest() );
+ InternalUtils.addActionMessage( propertyName, new ActionMessage(
messageKey, messageArgs ), getRequest() );
+ }
+
+ /**
+ * Add a property-related message as an expression that will be evaluated
and shown with the Errors and Error tags.
+ *
+ * @param propertyName the name of the property with which to associate
this error.
+ * @param expression the expression that will be evaluated to generate the
error message.
+ * @param messageArgs zero or more arguments to the message.
+ */
+ public void addActionMessageExpression( String propertyName, String
expression, Object ... messageArgs )
+ {
+ InternalUtils.addActionMessage( propertyName, new ExpressionMessage(
expression, messageArgs ), getRequest() );
}
/**
* Add a validation error that will be shown with the Errors and Error
tags.
+ * @deprecated Use [EMAIL PROTECTED] #addActionMessage} instead.
*
* @param propertyName the name of the property with which to associate
this error.
* @param messageKey the message-resources key for the error message.
+ * @param messageArgs an array of arguments for the error message.
*/
- protected void addValidationError( String propertyName, String messageKey )
+ protected void addValidationError( String propertyName, String messageKey,
Object[] messageArgs )
{
- PageFlowUtils.addValidationError( propertyName, messageKey,
getRequest() );
+ PageFlowUtils.addValidationError( propertyName, messageKey,
messageArgs, getRequest() );
}
/**
* Add a validation error that will be shown with the Errors and Error
tags.
+ * @deprecated Use [EMAIL PROTECTED] #addActionMessage} instead.
*
* @param propertyName the name of the property with which to associate
this error.
- * @param expression the expression that will be evaluated to generate the
error message.
+ * @param messageKey the message-resources key for the error message.
*/
- protected void addValidationErrorExpression( String propertyName, String
expression )
+ protected void addValidationError( String propertyName, String messageKey )
{
- PageFlowUtils.addValidationErrorExpression( propertyName, expression,
getRequest() );
+ PageFlowUtils.addValidationError( propertyName, messageKey,
getRequest() );
}
-
+
private static ActionForward handleSimpleAction( PageFlowActionMapping
mapping,
ActionForm
wrappedFormBean,
HttpServletRequest
request,
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
Tue Jan 25 16:11:49 2005
@@ -782,6 +782,7 @@
/**
* Add a validation error that will be shown with the Errors and Error
tags.
+ * @deprecated Use [EMAIL PROTECTED] #addActionMessage(ServletRequest,
String, String, Object[])} instead.
*
* @param propertyName the name of the property with which to associate
this error.
* @param messageKey the message-resources key for the error message.
@@ -791,12 +792,13 @@
public static void addValidationError( String propertyName, String
messageKey, Object[] messageArgs,
ServletRequest request )
{
- InternalUtils.addValidationError( propertyName, new ActionMessage(
messageKey, messageArgs ), request );
+ InternalUtils.addActionMessage( propertyName, new ActionMessage(
messageKey, messageArgs ), request );
}
/**
* Add a validation error that will be shown with the Errors and Error
tags.
+ * @deprecated Use [EMAIL PROTECTED] #addActionMessage(ServletRequest,
String, String, Object[])} instead.
*
* @param propertyName the name of the property with which to associate
this error.
* @param messageKey the message-resources key for the error message.
@@ -806,11 +808,12 @@
public static void addValidationError( String propertyName, String
messageKey, Object messageArg,
ServletRequest request )
{
- InternalUtils.addValidationError( propertyName, new ActionMessage(
messageKey, messageArg ), request );
+ addActionMessage( request, propertyName, messageKey, messageArg );
}
/**
* Add a validation error that will be shown with the Errors and Error
tags.
+ * @deprecated Use [EMAIL PROTECTED] #addActionMessage(ServletRequest,
String, String, Object[])} instead.
*
* @param propertyName the name of the property with which to associate
this error.
* @param messageKey the message-resources key for the error message.
@@ -818,19 +821,35 @@
*/
public static void addValidationError( String propertyName, String
messageKey, ServletRequest request )
{
- InternalUtils.addValidationError( propertyName, new ActionMessage(
messageKey ), request );
+ addActionMessage( request, propertyName, messageKey );
}
/**
- * Add a validation error that will be shown with the Errors and Error
tags.
+ * Add a property-related message that will be shown with the Errors and
Error tags.
*
+ * @param request the current ServletRequest.
* @param propertyName the name of the property with which to associate
this error.
- * @param expression the expression that will be evaluated to generate the
error message.
+ * @param messageKey the message-resources key for the message.
+ * @param messageArgs zero or more arguments to the message.
+ */
+ public static void addActionMessage( ServletRequest request, String
propertyName, String messageKey,
+ Object ... messageArgs )
+ {
+ InternalUtils.addActionMessage( propertyName, new ActionMessage(
messageKey, messageArgs ), request );
+ }
+
+ /**
+ * Add a property-related message as an expression that will be evaluated
and shown with the Errors and Error tags.
+ *
* @param request the current ServletRequest.
+ * @param propertyName the name of the property with which to associate
this error.
+ * @param expression the expression that will be evaluated to generate the
error message.
+ * @param messageArgs zero or more arguments to the message.
*/
- public static void addValidationErrorExpression( String propertyName,
String expression, ServletRequest request )
+ public static void addActionErrorExpression( ServletRequest request,
String propertyName, String expression,
+ Object ... messageArgs )
{
- InternalUtils.addValidationError( propertyName, new ExpressionMessage(
expression ), request );
+ InternalUtils.addActionMessage( propertyName, new ExpressionMessage(
expression, messageArgs ), request );
}
/**
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
Tue Jan 25 16:11:49 2005
@@ -51,6 +51,12 @@
* Optional.
*/
String validatorMerge() default "";
+
+ /**
+ * List of additional webapp-relative file paths to be added to the
'pathnames' property of the ValidatorPlugIn
+ * init.
+ */
+ String[] customValidatorConfigs() default {};
/**
* Location of the Tiles Definitions XML files; relative to the page
flow, or a path from the webapp root.
@@ -620,8 +626,8 @@
public @interface ValidateRange
{
boolean enabled() default true;
- int minInt() default 0;
- int maxInt() default -1;
+ long minInt() default 0;
+ long maxInt() default -1;
double minFloat() default 0;
double maxFloat() default -1;
String message() default "";
@@ -710,9 +716,8 @@
*/
@Target( ANNOTATION_TYPE )
@Retention( RUNTIME )
- public @interface ValidateCustom
+ public @interface ValidateCustomRule
{
- boolean enabled() default true;
String rule(); // required
ValidateCustomVariable[] variables() default {};
String message() default "";
@@ -745,7 +750,7 @@
ValidateCreditCard validateCreditCard() default
@ValidateCreditCard(enabled=false);
ValidateEmail validateEmail() default @ValidateEmail(enabled=false);
ValidateValidWhen validateValidWhen() default
@ValidateValidWhen(enabled=false, condition="");
- ValidateCustom validateCustom() default @ValidateCustom(enabled=false,
rule="");
+ ValidateCustomRule[] validateCustomRules() default {};
String language() default "";
String country() default "";
@@ -773,7 +778,7 @@
ValidateCreditCard validateCreditCard() default
@ValidateCreditCard(enabled=false);
ValidateEmail validateEmail() default @ValidateEmail(enabled=false);
ValidateValidWhen validateValidWhen() default
@ValidateValidWhen(enabled=false, condition="");
- ValidateCustom validateCustom() default @ValidateCustom(enabled=false,
rule="");
+ ValidateCustomRule[] validateCustomRules() default {};
ValidationLocaleRules[] localeRules() default {};
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Tue Jan 25 16:11:49 2005
@@ -323,15 +323,10 @@
}
}
- public static void addValidationError( String propertyName, ActionMessage
error, ServletRequest request )
+ public static void addActionMessage( String propertyName, ActionMessage
error, ServletRequest request )
{
ActionErrors errors = ( ActionErrors ) request.getAttribute(
Globals.ERROR_KEY );
-
- if ( errors == null )
- {
- request.setAttribute( Globals.ERROR_KEY, errors = new
ActionErrors() );
- }
-
+ if ( errors == null ) request.setAttribute( Globals.ERROR_KEY, errors
= new ActionErrors() );
errors.add( propertyName, error );
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java&r1=126447&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java
Tue Jan 25 16:11:49 2005
@@ -68,4 +68,59 @@
return true;
}
+
+ /**
+ * Checks if a fields value is within a range (min & max specified in
the
+ * vars attribute).
+ *
+ * @param bean The bean validation is being performed on.
+ * @param va The <code>ValidatorAction</code> that is currently
being performed.
+ * @param field The <code>Field</code> object associated with the
current
+ * field being validated.
+ * @param errors The <code>ActionMessages</code> object to add errors
to if any
+ * validation errors occur.
+ * @param request Current request object.
+ * @return True if in range, false otherwise.
+ */
+ public static boolean validateLongRange( Object bean,
+ ValidatorAction va, Field field,
+ ActionMessages errors,
+ HttpServletRequest request )
+ {
+
+ String value = null;
+
+ if ( isString( bean ) )
+ {
+ value = ( String ) bean;
+ }
+ else
+ {
+ value = ValidatorUtil.getValueAsString( bean, field.getProperty()
);
+ }
+
+ if ( ! GenericValidator.isBlankOrNull( value ) )
+ {
+ try
+ {
+ long longValue = Long.parseLong( value );
+ long min = Long.parseLong( field.getVarValue( "min" ) );
+ long max = Long.parseLong( field.getVarValue( "max" ) );
+
+ if ( !GenericValidator.isInRange( longValue, min, max ) )
+ {
+ errors.add( field.getKey(), Resources.getActionError(
request, va, field ) );
+
+ return false;
+ }
+ }
+ catch ( Exception e )
+ {
+ errors.add( field.getKey(), Resources.getActionError( request,
va, field ) );
+ return false;
+ }
+ }
+
+ return true;
+ }
}
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java&r1=126447&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
Tue Jan 25 16:11:49 2005
@@ -37,6 +37,7 @@
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.el.ELException;
import java.util.Locale;
+import java.text.MessageFormat;
abstract public class ErrorBaseTag extends AbstractSimpleTag
{
@@ -160,6 +161,8 @@
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
try {
message = InternalExpressionUtils.evaluateMessage(expression,
formBean, request, pageContext.getServletContext());
+ MessageFormat format = new MessageFormat(message);
+ message = format.format(messageArgs);
}
catch (ELException e) {
if (LOGGER.isErrorEnabled())
Modified:
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml&r1=126447&p2=incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml
(original)
+++
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-validator-rules.xml
Tue Jan 25 16:11:49 2005
@@ -19,8 +19,18 @@
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest,
- javax.servlet.ServletContext">
- </validator>
+ javax.servlet.ServletContext"/>
+
+ <validator name="netui_longRange"
+
classname="org.apache.beehive.netui.pageflow.validation.ValidatorRules"
+ method="validateLongRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ javax.servlet.http.HttpServletRequest"
+ depends="long"
+ msg="errors.range"/>
</global>
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf&r1=126447&p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf
Tue Jan 25 16:11:49 2005
@@ -25,12 +25,12 @@
)
public Forward addMessages( MyBean bean )
{
- getRequest().setAttribute( "requestMessage", "a message in the
request" );
+ getRequest().setAttribute( "requestMessage", "a message in the request
with two arguments: {0} and {1}" );
getSession().setAttribute( "sessionMessage", "a message in the
session" );
- addValidationErrorExpression( "prop1", "${pageFlow.pageFlowMessage}" );
- addValidationErrorExpression( "prop2",
"${requestScope.requestMessage}" );
- addValidationErrorExpression( "prop3",
"${sessionScope.sessionMessage}" );
+ addActionMessageExpression( "prop1", "${pageFlow.pageFlowMessage}" );
+ addActionMessageExpression( "prop2", "${requestScope.requestMessage}",
"ARG1", "ARG2" );
+ addActionMessageExpression( "prop3", "${sessionScope.sessionMessage}"
);
return new Forward( "index" );
}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/Controller.jpf?view=auto&rev=126448
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/Controller.jpf
Tue Jan 25 16:11:49 2005
@@ -0,0 +1,131 @@
+package validation.custom;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+import org.apache.commons.validator.*;
+import org.apache.struts.validator.*;
+import org.apache.struts.action.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ },
+ customValidatorConfigs={
+ // Note: normally, this file would go in WEB-INF. It's here to
encapsulate the test.
+ "/validation/custom/customrules.xml"
+ }
+)
+public class Controller extends PageFlowController
+{
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="success", path="success.jsp")
+ },
+ [EMAIL PROTECTED](name="failure", path="index.jsp")
+ )
+ public Forward submit( MyForm form )
+ {
+ return new Forward( "success" );
+ }
+
+ public static class MyForm
+ {
+ private String _val;
+
+ @Jpf.ValidatableProperty(
+ // for internationalization, use 'displayNameKey', or an
expression in 'displayName'
+ displayName="The value",
+ [EMAIL PROTECTED](),
+ validateCustomRules={
+ @Jpf.ValidateCustomRule(
+ rule="customRuleDivisibleBy",
+ // for internationalization, use 'messageKey', or an
expression in 'message'
+ message="{0} must be divisible by {1}.",
+ [EMAIL PROTECTED](name="factor", value="3")}
+ ),
+ @Jpf.ValidateCustomRule(rule="customRulePalindrome",
message="{0} must be a palindrome.")
+ }
+ )
+ public String getVal()
+ {
+ return _val;
+ }
+
+ public void setVal( String val )
+ {
+ _val = val;
+ }
+ }
+
+ /**
+ * This is the method for the 'customRulePalindrome' rule. Normally it
would go in a separate class.
+ */
+ public static boolean validatePalindrome( Object bean, ValidatorAction va,
Field field, ActionMessages errors,
+ HttpServletRequest request,
ServletContext servletContext )
+ {
+ String value;
+
+ if ( bean == null || bean instanceof String )
+ {
+ value = ( String ) bean;
+ }
+ else
+ {
+ value = ValidatorUtil.getValueAsString( bean, field.getProperty()
);
+ }
+
+ if ( ! GenericValidator.isBlankOrNull( value ) )
+ {
+ for ( int i = 0, len = value.length(); i < len; ++i )
+ {
+ if ( value.charAt( i ) != value.charAt( len - i - 1 ) )
+ {
+ errors.add( field.getKey(), Resources.getActionError(
request, va, field ) );
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * This is the method for the 'customRuleDivisibleBy' rule. Normally it
would go in a separate class.
+ */
+ public static boolean validateDivisibleBy( Object bean, ValidatorAction
va, Field field, ActionMessages errors,
+ HttpServletRequest request,
ServletContext servletContext )
+ {
+ String value;
+
+ if ( bean == null || bean instanceof String )
+ {
+ value = ( String ) bean;
+ }
+ else
+ {
+ value = ValidatorUtil.getValueAsString( bean, field.getProperty()
);
+ }
+
+ if ( ! GenericValidator.isBlankOrNull( value ) )
+ {
+
+ try
+ {
+ String factor = field.getVarValue( "factor" );
+ if ( Integer.parseInt( value ) % Integer.parseInt( factor ) ==
0 ) return true;
+ }
+ catch ( NumberFormatException e )
+ {
+ // error will be returned below
+ }
+
+ errors.add( field.getKey(), Resources.getActionError( request, va,
field ) );
+ return false;
+ }
+
+ return true;
+ }
+
+}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/customrules.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/customrules.xml?view=auto&rev=126448
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/customrules.xml
Tue Jan 25 16:11:49 2005
@@ -0,0 +1,33 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
+
+<form-validation>
+
+ <global>
+
+ <validator name="customRulePalindrome"
+ classname="validation.custom.Controller"
+ method="validatePalindrome"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ javax.servlet.http.HttpServletRequest,
+ javax.servlet.ServletContext" >
+ </validator>
+
+ <validator name="customRuleDivisibleBy"
+ classname="validation.custom.Controller"
+ method="validateDivisibleBy"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ javax.servlet.http.HttpServletRequest,
+ javax.servlet.ServletContext" >
+ </validator>
+
+ </global>
+
+</form-validation>
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/index.jsp?view=auto&rev=126448
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/index.jsp
Tue Jan 25 16:11:49 2005
@@ -0,0 +1,24 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <h3>${pageFlow.URI}</h3>
+
+ <netui:form action="submit">
+ val: <netui:textBox dataSource="actionForm.val"/> <netui:error
value="val"/>
+ <br/>
+ <br/>
+ <netui:button value="submit"/>
+ </netui:form>
+ </netui:body>
+</netui:html>
+
+
+
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/success.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/success.jsp?view=auto&rev=126448
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/custom/success.jsp
Tue Jan 25 16:11:49 2005
@@ -0,0 +1,22 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <h3>${pageFlow.URI}</h3>
+
+ Validation passed.
+ <br/>
+ <br/>
+ <netui:anchor action="begin">start over</netui:anchor>
+ </netui:body>
+</netui:html>
+
+
+
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=126447&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Tue Jan 25 16:11:49 2005
@@ -6321,6 +6321,20 @@
</features>
</test>
<test>
+ <name>ValidateCustom</name>
+ <description>Test of the @Jpf.ValidateCustom annotation, for user
custom validation rules.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>corePageFlow</category>
+ </categories>
+ <features>
+ <feature>Form</feature>
+ <feature>Validation</feature>
+ </features>
+ </test>
+ <test>
<name>ValidateField</name>
<description>Ensure that a specific locale rule on a field
(Jpf.ValidationLocaleRules annotation) fires even if there are no default rules
defined for the field.</description>
<webapp>coreWeb</webapp>
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml?view=diff&rev=126448&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml&r1=126447&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml&r2=126448
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/AddExpressionMessages.xml
Tue Jan 25 16:11:49 2005
@@ -3,7 +3,7 @@
<ses:sessionName>AddExpressionMessages</ses:sessionName>
<ses:tester>rich</ses:tester>
<ses:startDate>24 Jan 2005, 05:37:09.027 PM MST</ses:startDate>
- <ses:description>Test of using ExpressionMessage (or
FlowController.addValidationErrorExpression) to add explicit strings or
expressions as validation messages.</ses:description>
+ <ses:description>Test of using ExpressionMessage (or
FlowController.addActionMessageExpression) to add explicit strings or
expressions as validation messages.</ses:description>
<ses:tests>
<ses:test>
<ses:testNumber>1</ses:testNumber>
@@ -159,7 +159,7 @@
<body>
message for prop1: <b>a message in page flow
/validation/addExpressionMessages/Controller.jpf
</b><br/>
- message for prop2: <b>a message in the request
+ message for prop2: <b>a message in the request with two arguments:
ARG1 and ARG2
</b><br/>
message for prop3: <b>a message in the session
</b><br/>
Added:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateCustom.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateCustom.xml?view=auto&rev=126448
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/ValidateCustom.xml
Tue Jan 25 16:11:49 2005
@@ -0,0 +1,475 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+ <ses:sessionName>ValidateCustom</ses:sessionName>
+ <ses:tester>rich</ses:tester>
+ <ses:startDate>25 Jan 2005, 02:39:05.214 PM MST</ses:startDate>
+ <ses:description>Test of the @Jpf.ValidateCustom annotation, for user
custom validation rules.</ses:description>
+ <ses:tests>
+ <ses:test>
+ <ses:testNumber>1</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/validation/custom/Controller.jpf</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/validation/custom/index.jsp">
+ </head>
+ <body>
+ <h3>/validation/custom/Controller.jpf</h3>
+
+ <form name="myForm" action="/coreWeb/validation/custom/submit.do"
method="post">
+ val: <input type="text" name="{actionForm.val}">
+ <br/>
+ <br/>
+ <input type="submit" value="submit">
+ </form>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>2</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/validation/custom/submit.do</ses:uri>
+ <ses:method>POST</ses:method>
+ <ses:parameters>
+ <ses:parameter>
+ <ses:name>{actionForm.val}</ses:name>
+ <ses:value/>
+ </ses:parameter>
+ </ses:parameters>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-length</ses:name>
+ <ses:value>21</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-type</ses:name>
+ <ses:value>application/x-www-form-urlencoded</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/validation/custom/Controller.jpf</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/validation/custom/index.jsp">
+ </head>
+ <body>
+ <h3>/validation/custom/Controller.jpf</h3>
+
+ <form name="myForm" action="/coreWeb/validation/custom/submit.do"
method="post">
+ val: <input type="text" name="{actionForm.val}"> The value is
required.
+
+ <br/>
+ <br/>
+ <input type="submit" value="submit">
+ </form>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>3</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/validation/custom/submit.do</ses:uri>
+ <ses:method>POST</ses:method>
+ <ses:parameters>
+ <ses:parameter>
+ <ses:name>{actionForm.val}</ses:name>
+ <ses:value>hello</ses:value>
+ </ses:parameter>
+ </ses:parameters>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-length</ses:name>
+ <ses:value>26</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-type</ses:name>
+ <ses:value>application/x-www-form-urlencoded</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/validation/custom/submit.do</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/validation/custom/index.jsp">
+ </head>
+ <body>
+ <h3>/validation/custom/Controller.jpf</h3>
+
+ <form name="myForm" action="/coreWeb/validation/custom/submit.do"
method="post">
+ val: <input type="text" name="{actionForm.val}" value="hello"> The
value must be divisible by 3.
+
+ <br/>
+ <br/>
+ <input type="submit" value="submit">
+ </form>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>4</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/validation/custom/submit.do</ses:uri>
+ <ses:method>POST</ses:method>
+ <ses:parameters>
+ <ses:parameter>
+ <ses:name>{actionForm.val}</ses:name>
+ <ses:value>3336</ses:value>
+ </ses:parameter>
+ </ses:parameters>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-length</ses:name>
+ <ses:value>25</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-type</ses:name>
+ <ses:value>application/x-www-form-urlencoded</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/validation/custom/submit.do</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/validation/custom/index.jsp">
+ </head>
+ <body>
+ <h3>/validation/custom/Controller.jpf</h3>
+
+ <form name="myForm" action="/coreWeb/validation/custom/submit.do"
method="post">
+ val: <input type="text" name="{actionForm.val}" value="3336"> The
value must be a palindrome.
+
+ <br/>
+ <br/>
+ <input type="submit" value="submit">
+ </form>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>5</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/validation/custom/submit.do</ses:uri>
+ <ses:method>POST</ses:method>
+ <ses:parameters>
+ <ses:parameter>
+ <ses:name>{actionForm.val}</ses:name>
+ <ses:value>6336</ses:value>
+ </ses:parameter>
+ </ses:parameters>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-length</ses:name>
+ <ses:value>25</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>content-type</ses:name>
+ <ses:value>application/x-www-form-urlencoded</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=A38E446A4A29526D211DAF2CA6A8AF01</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/validation/custom/submit.do</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base
href="http://localhost:8080/coreWeb/validation/custom/success.jsp">
+ </head>
+ <body>
+ <h3>/validation/custom/Controller.jpf</h3>
+
+ Validation passed.
+ <br/>
+ <br/>
+ <a href="/coreWeb/validation/custom/begin.do">start over</a>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ </ses:tests>
+ <ses:endDate>25 Jan 2005, 02:39:50.199 PM MST</ses:endDate>
+ <ses:testCount>5</ses:testCount>
+</ses:recorderSession>