Commits

Anonymous committed fc76e34

- pure client side validation for xhtml theme
- ajax client side validation for ajax theme (using DWR)
- Validator interface now has setter/getter for the type (requiredstring, int, etc),
which is used by the pure client side implementation

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@720e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 82c027f

Comments (0)

Files changed (5)

File src/java/com/opensymphony/xwork/validator/ActionValidatorManager.java

         for (Iterator iterator = cfgs.iterator(); iterator.hasNext(); ) {
             ValidatorConfig cfg = (ValidatorConfig) iterator.next();
             Validator validator = ValidatorFactory.getValidator(cfg);
+            validator.setValidatorType(cfg.getType());
             validators.add(validator);
         }
 

File src/java/com/opensymphony/xwork/validator/Validator.java

      * @throws ValidationException
      */
     void validate(Object object) throws ValidationException;
+
+    void setValidatorType(String type);
+
+    String getValidatorType();
 }

File src/java/com/opensymphony/xwork/validator/validators/AbstractRangeValidator.java

  *         Created Feb 9, 2003 1:16:28 AM
  */
 public abstract class AbstractRangeValidator extends FieldValidatorSupport {
+    private String name;
 
     public void validate(Object object) throws ValidationException {
         Object obj = getFieldValue(getFieldName(), object);

File src/java/com/opensymphony/xwork/validator/validators/FieldValidatorSupport.java

  * @author Jason Carreira
  */
 public abstract class FieldValidatorSupport extends ValidatorSupport implements FieldValidator {
-
     private String fieldName = null;
-
+    private String type;
 
     public void setFieldName(String fieldName) {
         this.fieldName = fieldName;
     public String getFieldName() {
         return fieldName;
     }
+
+    public void setValidatorType(String type) {
+        this.type = type;
+    }
+
+    public String getValidatorType() {
+        return type;
+    }
 }

File src/java/com/opensymphony/xwork/validator/validators/ValidatorSupport.java

     protected String messageKey = null;
     private ValidatorContext validatorContext;
     private boolean shortCircuit;
+    private String type;
 
 
     public void setDefaultMessage(String message) {
         return validatorContext;
     }
 
+    public void setValidatorType(String type) {
+        this.type = type;
+    }
+
+    public String getValidatorType() {
+        return type;
+    }
+
     protected Object getFieldValue(String name, Object object) throws ValidationException {
         OgnlValueStack stack = ActionContext.getContext().getValueStack();