org.apache.struts.validator

Class ValidatorPlugIn

public class ValidatorPlugIn extends Object implements PlugIn

Loads ValidatorResources based on configuration in the struts-config.xml file.

Since: Struts 1.1

Version: $Rev: 105785 $ $Date: 2004-11-19 06:58:36 +0000 (Fri, 19 Nov 2004) $

Field Summary
ModuleConfigconfig
The module configuration for our owning module.
static Loglog
Commons Logging instance.
Stringpathnames
A comma delimitted list of Validator resource.
protected ValidatorResourcesresources
The set of Form instances that have been created and initialized, keyed by the struts form name.
static StringRESOURCE_DELIM
Delimitter for Validator resources.
ActionServletservlet
The ActionServlet owning this application.
booleanstopOnFirstError
Informs the Validators if it has to stop validation when finding the first error or if it should continue.
static StringSTOP_ON_ERROR_KEY
Application scope key that StopOnError is stored under.
static StringVALIDATOR_KEY
Application scope key that ValidatorResources is stored under.
Method Summary
voiddestroy()
Gracefully shut down, releasing any resources that were allocated at initialization.
protected voiddestroyResources()
Destroy ValidatorResources.
StringgetPathnames()
Gets a comma delimitted list of Validator resources.
voidinit(ActionServlet servlet, ModuleConfig config)
Initialize and load our resources.
protected voidinitResources()
Initialize the validator resources for this module.
booleanisStopOnFirstError()
Gets the value for stopOnFirstError.
voidsetPathnames(String pathnames)
Sets a comma delimitted list of Validator resources.
voidsetStopOnFirstError(boolean stopOnFirstError)
Sets the value for stopOnFirstError.

Field Detail

config

private ModuleConfig config
The module configuration for our owning module.

log

private static Log log
Commons Logging instance.

pathnames

private String pathnames
A comma delimitted list of Validator resource.

resources

protected ValidatorResources resources
The set of Form instances that have been created and initialized, keyed by the struts form name.

RESOURCE_DELIM

private static final String RESOURCE_DELIM
Delimitter for Validator resources.

servlet

private ActionServlet servlet
The ActionServlet owning this application.

stopOnFirstError

private boolean stopOnFirstError
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.

STOP_ON_ERROR_KEY

public static final String STOP_ON_ERROR_KEY
Application scope key that StopOnError is stored under.

Since: Struts 1.2

VALIDATOR_KEY

public static final String VALIDATOR_KEY
Application scope key that ValidatorResources is stored under.

Method Detail

destroy

public void destroy()
Gracefully shut down, releasing any resources that were allocated at initialization.

destroyResources

protected void destroyResources()
Destroy ValidatorResources.

getPathnames

public String getPathnames()
Gets a comma delimitted list of Validator resources.

Returns: comma delimited list of Validator resource path names

init

public void init(ActionServlet servlet, ModuleConfig config)
Initialize and load our resources.

Parameters: servlet The ActionServlet for our application config The ModuleConfig for our owning module

Throws: ServletException if we cannot configure ourselves correctly

initResources

protected void initResources()
Initialize the validator resources for this module.

Throws: IOException if an input/output error is encountered ServletException if we cannot initialize these resources

isStopOnFirstError

public boolean isStopOnFirstError()
Gets the value for stopOnFirstError.

Returns: A boolean indicating whether JavaScript validation should stop when it finds the first error (Struts 1.1 behaviour) or continue validation.

Since: Struts 1.2

setPathnames

public void setPathnames(String pathnames)
Sets a comma delimitted list of Validator resources.

Parameters: pathnames delimited list of Validator resource path names

setStopOnFirstError

public void setStopOnFirstError(boolean stopOnFirstError)
Sets the value for stopOnFirstError.

Parameters: stopOnFirstError A boolean indicating whether JavaScript validation should stop when it finds the first error (Struts 1.1 behaviour) or continue validation.

Since: Struts 1.2

Copyright B) 2000-2009 - The Apache Software Foundation