|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.template.Template
sunlabs.brazil.sunlabs.ValidateTemplate
public class ValidateTemplate
The ValidateTemplate
is designed to validate
HTML forms. It performs data validation on sets of
properties (e.g. form values) by comparing the values against
validation constraints that are specified in other variables.
The "glob" attribute defines the set of variables to be
validated, and the "types" attribute maps each variable name
matched by "glob" into the variable that names the validation
tokens for that variable to be validated.
The "types" attribute, which is used to identify the
validation types may contain variables of the form, ${n} where
0 < n < 10 which represent the string value matching the nth wildcard
in the "glob" attribute.
Example: glob=*.*.*.*.* and types=types.${3}.${1}
will validate a.b.c.d.e against the types contained in types.c.a
The default for types
is validate.${1}
For each validate request, all properties matching the specified
glob
pattern will be validated against pre-loaded validation
keys specified by the glob pattern match types
. The result
will be stored in properties prepended by the prefix
attribute,
which defaults to the template's prefix.
<validate glob=pattern [prefix=prepend types=pattern (${1-9}.${1-9})]>
Properties validated by ValidateTemplate
Validation of properties propNames
against glob,
regular expression, logic/arithmetic expression, max
value (integer), max length (string), min value(integer), min length (string)
if validation properties exist. If there are n validation properties, then
all n are evaulated. A property can fail on multiple validations.
types
and glob
type
=
propName
propName
defined in the types list.
propName
defined in the
types list.
propName
is an integer.
propName
is an integer.
propName
is a string.
propName
is a string
Properties set by ValidateTemplate
If validation fails, the error message to be displayed to the user is up to
the developer. ValidateTemplate does not store any error messages.
The default for prepend is validate.
Nested Class Summary | |
---|---|
static class |
ValidateTemplate.GlobFormat
Special version of a format that uses uses the previously defined GlobProperties. |
static class |
ValidateTemplate.GlobProperties
Special version of a properties that uses the sub expresions of the supplied glob pattern and type to define the keys 1-9. |
Field Summary |
---|
Fields inherited from class sunlabs.brazil.template.Template |
---|
debug |
Constructor Summary | |
---|---|
ValidateTemplate()
|
Method Summary | |
---|---|
boolean |
init(RewriteContext hr)
Called before this template processes any tags. |
void |
tag_validate(RewriteContext hr)
|
Methods inherited from class sunlabs.brazil.template.Template |
---|
debug, debug, done |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidateTemplate()
Method Detail |
---|
public boolean init(RewriteContext hr)
Template
init
in interface TemplateInterface
init
in class Template
public void tag_validate(RewriteContext hr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |