Class JavascriptValidatorComponent
java.lang.Object
jakarta.faces.component.UIComponent
jakarta.faces.component.UIComponentBase
jakarta.faces.component.UIOutput
org.apache.struts.faces.component.JavascriptValidatorComponent
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,ValueHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
JavascriptValidatorComponent
is a specialized
subclass of UIOutput
that supports automatic creation of
JavaScript for client side validation based on the validation
rules loaded by the ValidatorPlugIn
defined in the
struts-config.xml
file. This is based on the code in
the corresponding class of the Struts HTML tag library, modified
as needed to reflect differences in the way JavaServer Faces
renders field identifiers.- Version:
- $Rev$ $Date$
-
Field Summary
Fields inherited from class jakarta.faces.component.UIOutput
COMPONENT_FAMILY, COMPONENT_TYPE
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the MessageResources key.Return the component family to which this component belongs.Gets the key (form name) that will be used to retrieve a set of validation rules to be performed on the bean passed in for validation.Gets the method name that will be used for the JavaScript validation method name if it has a value.int
getPage()
Gets the current page number of a multi-part form.getSrc()
Gets the src attribute's value when defining the html script element.boolean
isCdata()
Returns the cdata setting "true" or "false".boolean
Gets whether or not to generate the dynamic JavaScript.boolean
Gets whether or not to delimit the JavaScript with HTML comments.boolean
Gets whether or not to generate the static JavaScript.void
restoreState
(FacesContext context, Object state) Restore our state from the specified object.saveState
(FacesContext context) Create and return an object representing our state to be saved.void
Set the MessageResources key.void
setCdata
(boolean cdata) Sets the CDATA status.void
setDynamicJavascript
(boolean dynamicJavascript) Sets whether or not to generate the dynamic JavaScript.void
setFormName
(String formName) Sets the key (form name) that will be used to retrieve a set of validation rules to be performed on the bean passed in for validation.void
setHtmlComment
(boolean htmlComment) Sets whether or not to delimit the JavaScript with HTML comments.void
Sets the method name that will be used for the JavaScript validation method name if it has a value.void
setPage
(int page) Sets the current page number of a multi-part form.void
Sets the src attribute's value when defining the html script element.void
setStaticJavascript
(boolean staticJavascript) Sets whether or not to generate the static JavaScript.Methods inherited from class jakarta.faces.component.UIOutput
clearInitialState, getConverter, getLocalValue, getValue, markInitialState, resetValue, setConverter, setValue
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
-
Constructor Details
-
JavascriptValidatorComponent
public JavascriptValidatorComponent()Create a newJavascriptValidatorComponent
with default properties.
-
-
Method Details
-
getBundle
Return the MessageResources key. -
setBundle
Set the MessageResources key.- Parameters:
bundle
- The new key
-
getFamily
Return the component family to which this component belongs. -
getFormName
Gets the key (form name) that will be used to retrieve a set of validation rules to be performed on the bean passed in for validation. -
setFormName
Sets the key (form name) that will be used to retrieve a set of validation rules to be performed on the bean passed in for validation. Specifying a form name places a <script> </script> tag around the javascript. -
getPage
public int getPage()Gets the current page number of a multi-part form. Only field validations with a matching page numer will be generated that match the current page number. Only valid when the formName attribute is set. -
setPage
public void setPage(int page) Sets the current page number of a multi-part form. Only field validations with a matching page numer will be generated that match the current page number. Only valid when the formName attribute is set. -
getMethod
Gets the method name that will be used for the JavaScript validation method name if it has a value. This overrides the auto-generated method name based on the key (form name) passed in. -
setMethod
Sets the method name that will be used for the JavaScript validation method name if it has a value. This overrides the auto-generated method name based on the key (form name) passed in. -
isStaticJavascript
public boolean isStaticJavascript()Gets whether or not to generate the static JavaScript. If this is set to 'true', which is the default, the static JavaScript will be generated. -
setStaticJavascript
public void setStaticJavascript(boolean staticJavascript) Sets whether or not to generate the static JavaScript. If this is set to 'true', which is the default, the static JavaScript will be generated. -
isDynamicJavascript
public boolean isDynamicJavascript()Gets whether or not to generate the dynamic JavaScript. If this is set to 'true', which is the default, the dynamic JavaScript will be generated. -
setDynamicJavascript
public void setDynamicJavascript(boolean dynamicJavascript) Sets whether or not to generate the dynamic JavaScript. If this is set to 'true', which is the default, the dynamic JavaScript will be generated. -
getSrc
Gets the src attribute's value when defining the html script element. -
setSrc
Sets the src attribute's value when defining the html script element. The src attribute is only recognized when the formName attribute is specified. -
isHtmlComment
public boolean isHtmlComment()Gets whether or not to delimit the JavaScript with HTML comments. If this is set to 'true', which is the default, the HTML- Comment will be surround the JavaScript. -
setHtmlComment
public void setHtmlComment(boolean htmlComment) Sets whether or not to delimit the JavaScript with HTML comments. If this is set to 'true', which is the default, the HTML- Comment will be surround the JavaScript. -
isCdata
public boolean isCdata()Returns the cdata setting "true" or "false".- Returns:
- String - "true" if JavaScript will be hidden in a CDATA section
-
setCdata
public void setCdata(boolean cdata) Sets the CDATA status.- Parameters:
cdata
- The CDATA to set
-
restoreState
Restore our state from the specified object.
- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIOutput
- Parameters:
context
-FacesContext
for the current requeststate
- Object containing our saved state
-
saveState
Create and return an object representing our state to be saved.
- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIOutput
- Parameters:
context
-FacesContext
for the current request
-