Class JavascriptValidatorComponent

All Implemented Interfaces:
PartialStateHolder, StateHolder, TransientStateHolder, ValueHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

public class JavascriptValidatorComponent extends UIOutput
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$
  • Constructor Details

  • Method Details

    • getBundle

      public String getBundle()
      Return the MessageResources key.
    • setBundle

      public void setBundle(String bundle)
      Set the MessageResources key.
      Parameters:
      bundle - The new key
    • getFamily

      public String getFamily()
      Return the component family to which this component belongs.
      Overrides:
      getFamily in class UIOutput
    • getFormName

      public String 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

      public 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. 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

      public String 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

      public void setMethod(String method)
      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

      public String getSrc()
      Gets the src attribute's value when defining the html script element.
    • setSrc

      public void setSrc(String src)
      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

      public void restoreState(FacesContext context, Object state)

      Restore our state from the specified object.

      Specified by:
      restoreState in interface StateHolder
      Overrides:
      restoreState in class UIOutput
      Parameters:
      context - FacesContext for the current request
      state - Object containing our saved state
    • saveState

      public Object saveState(FacesContext context)

      Create and return an object representing our state to be saved.

      Specified by:
      saveState in interface StateHolder
      Overrides:
      saveState in class UIOutput
      Parameters:
      context - FacesContext for the current request