rleland 2003/07/27 22:54:11 Modified: src/share/org/apache/struts/validator ValidatorPlugIn.java Log: Bug 20754, Enhancement to allow checking of all constraints instead of aborting. The default is same as struts 1.1. Patch for struts 1.1 RC2 provided by (Marcelo Caldas) Revision Changes Path 1.18 +37 -5 jakarta-struts/src/share/org/apache/struts/validator/ValidatorPlugIn.java Index: ValidatorPlugIn.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/validator/ValidatorPlugIn.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ValidatorPlugIn.java 22 May 2003 00:42:29 -0000 1.17 +++ ValidatorPlugIn.java 28 Jul 2003 05:54:10 -0000 1.18 @@ -112,6 +112,11 @@ public final static String VALIDATOR_KEY = "org.apache.commons.validator.VALIDATOR_RESOURCES"; /** + * Application scope key that <code>StopOnError</code> is stored under. + */ + public final static String STOP_ON_ERROR_KEY = "org.apache.struts.validator.STOP_ON_ERROR"; + + /** * The set of Form instances that have been created and initialized, * keyed by the struts form name. */ @@ -142,6 +147,31 @@ } /** + * Informs the Validators if it has to stop validation when finding the first Error + * or if it should continue. + * Default to true to keep struts 1.1 backwards compatibility. + */ + private boolean stopOnFirstError = true; + + /** + * Gets the value for stopOnFirstError. + * @return a boolean indicating whether javascript validator should stop when finds the first error + * ,struts 1.1 behaviour, or continue validation. + */ + public boolean isStopOnFirstError() { + return stopOnFirstError; + } + + /** + * Sets the value for stopOnFirstError. + * @param newValue a boolean indicating whether javascript validator should stop when finds the first error + * ,struts 1.1 behaviour, or continue validation. + */ + public void setStopOnFirstError(boolean newValue) { + this.stopOnFirstError = newValue; + } + + /** * Initialize and load our resources. * * @param servlet The ActionServlet for our application @@ -162,7 +192,9 @@ servlet.getServletContext().setAttribute( VALIDATOR_KEY + config.getPrefix(), resources); - + servlet.getServletContext().setAttribute( + STOP_ON_ERROR_KEY + '.'+config.getPrefix(), + new Boolean(stopOnFirstError)); } catch (Exception e) { log.error(e.getMessage(), e); throw new UnavailableException(
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]