|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.javalid.external.jsf.JvJsfContextListener
public class JvJsfContextListener
Use this context listener to store both the AnnotationValidator and the JvJsfConfiguration instance in the servlet context. The UpdateValuesPhaseListener does depend on this (if you use it).
AnnotationValidator is stored under the key 'JsfFacadeShared.KEY_ANNOTATION_VALIDATOR_LOCATION'. JvJsfConfiguration is stored under JsfFacadeShared.KEY_JSF_CONFIGURATION_LOCATION.
The listener expects an init-parameter in the web.xml file named: 'jv-jsf-config-file' containing the full path of the xml configuration file for jsf support.
To load the annotation validator specify an xml file by init-parameter: 'jv-config-file', else a default AnnotationValidator config file is used.
Finally to use a different AnnotationValidator you can specify jv-validator-class in the web.xml as
init-parameter telling what class to use. Note the validator must have at least 1 parameter representing
the xmlConfigFile to use to load (java.lang.String). The optional second parameter is:
jv-value-to-null-if-empty: either true or false. If true, String / StringBuffer values being bound
on an object, if they are empty "" (jsf mostly submits empty values of users as "" instead of null) are
set to NULL during validation (not on the object itself) to prevent firing other validation annotations.
This is relevant for non-required fields. By default the annotationvalidator sets this option to false (default
framework behavior), override it here if needed (and you likely need it!).
Changes for 1.0.1:
| Field Summary | |
|---|---|
static java.lang.String |
JV_ANNOTATION_VALIDATOR_CONFIG_FILE_INIT_PARAM
Servlet init parameter name (web.xml), the value should tell what JV config file to use (full path). |
static java.lang.String |
JV_ANNOTATION_VALIDATOR_IMPLEMENTATION_CLASS_INIT_PARAM
Servlet init parameter name (web.xml), denoting which AnnotationValidator class must be instantiated (and stored in the servlet context). |
static java.lang.String |
JV_JSF_CONFIG_FILE_INIT_PARAM
Servlet init parameter name (web.xml), the value should tell what config file to use (full path). |
static java.lang.String |
JV_VALUE_TO_NULL_FOR_EMPTY_STRING_INIT_PARAM
Servlet init parameter name (web.xml), denoting whether to set empty string/stringbuffer values to null during validation. |
| Constructor Summary | |
|---|---|
JvJsfContextListener()
|
|
| Method Summary | |
|---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent event)
|
void |
contextInitialized(javax.servlet.ServletContextEvent event)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String JV_JSF_CONFIG_FILE_INIT_PARAM
public static final java.lang.String JV_ANNOTATION_VALIDATOR_CONFIG_FILE_INIT_PARAM
public static final java.lang.String JV_ANNOTATION_VALIDATOR_IMPLEMENTATION_CLASS_INIT_PARAM
public static final java.lang.String JV_VALUE_TO_NULL_FOR_EMPTY_STRING_INIT_PARAM
| Constructor Detail |
|---|
public JvJsfContextListener()
| Method Detail |
|---|
public void contextInitialized(javax.servlet.ServletContextEvent event)
contextInitialized in interface javax.servlet.ServletContextListenerpublic void contextDestroyed(javax.servlet.ServletContextEvent event)
contextDestroyed in interface javax.servlet.ServletContextListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||