Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.taglib.html
Class JavascriptValidatorTag

    java.lang.Object
      |
      +--javax.servlet.jsp.tagext.TagSupport
            |
            +--javax.servlet.jsp.tagext.BodyTagSupport
                  |
                  +--org.apache.struts.taglib.html.JavascriptValidatorTag

All Implemented Interfaces:
  javax.servlet.jsp.tagext.BodyTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class JavascriptValidatorTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Custom tag that generates JavaScript for client side validation based on the validation rules loaded by the `ValidatorPlugIn` defined in the struts-config.xml file.

Since:
  Struts 1.1
Version:
  $Revision: 1.1 $ $Date: 2003/08/26 12:57:38 $
Author:
  David Winterfeldt
See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `bundle` The servlet context attribute key for our resources.
`protected java.lang.String` | `cdata` Hide JavaScript methods in a CDATA section for XHTML when "true".
`protected static java.util.Locale` | `defaultLocale` Deprecated. This variable is no longer used.
`protected java.lang.String` | `dynamicJavascript` The dynamic JavaScript objects will only be generated if this is set to "true".
`protected java.lang.String` | `formName` The name of the form that corresponds with the action name in struts-config.xml.
`private java.lang.String` | `htmlBeginComment`
`protected java.lang.String` | `htmlComment` The JavaScript methods will enclosed with html comments if this is set to "true".
`private java.lang.String` | `htmlEndComment`
`protected static java.lang.String` | `lineEnd` The line ending string.
`protected java.lang.String` | `methodName` This will be used as is for the JavaScript validation method name if it has a value.
`protected int` | `page` The current page number of a multi-part form.
`protected java.lang.String` | `src` The src attribute for html script element (used to include an external script resource).
`protected java.lang.String` | `staticJavascript` The static JavaScript methods will only be printed if this is set to "true".

Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`bodyContent`

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`id, pageContext`

Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
`EVAL_BODY_TAG`

Fields inherited from interface javax.servlet.jsp.tagext.Tag
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

Constructor Summary
`JavascriptValidatorTag()`

Method Summary
`int` | `doStartTag()` Render the JavaScript for to perform validations based on the form name.
`java.lang.String` | `getCdata()` Returns the cdata setting "true" or "false".
`java.lang.String` | `getDynamicJavascript()` Gets whether or not to generate the dynamic JavaScript.
`java.lang.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.
`java.lang.String` | `getHtmlComment()` Gets whether or not to delimit the JavaScript with html comments.
`protected java.lang.String` | `getJavascriptBegin(java.lang.String methods)` Returns the opening script element and some initial javascript.
`protected java.lang.String` | `getJavascriptEnd()` Returns the closing script element.
`protected java.lang.String` | `getJavascriptStaticMethods(org.apache.commons.validator.ValidatorResources resources)`
`java.lang.String` | `getMethod()` Gets the method name that will be used for the Javascript validation method name if it has a value.
`private java.lang.String` | `getNextVar(java.lang.String input)` The value `null` will be returned at the end of the sequence.
`int` | `getPage()` Gets the current page number of a multi-part form.
`java.lang.String` | `getSrc()` Gets the src attribute's value when defining the html script element.
`private java.lang.String` | `getStartElement()` Constructs the beginning <script> element depending on xhtml status.
`java.lang.String` | `getStaticJavascript()` Gets whether or not to generate the static JavaScript.
`private boolean` | `isXhtml()` Returns true if this is an xhtml page.
`void` | `release()` Release any acquired resources.
`private java.lang.String` | `replaceChar(java.lang.String input, int pos, char c)` Replaces a single character in a `String`
`void` | `setCdata(java.lang.String cdata)` Sets the cdata status.
`void` | `setDynamicJavascript(java.lang.String dynamicJavascript)` Sets whether or not to generate the dynamic JavaScript.
`void` | `setFormName(java.lang.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(java.lang.String htmlComment)` Sets whether or not to delimit the JavaScript with html comments.
`void` | `setMethod(java.lang.String methodName)` 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` | `setSrc(java.lang.String src)` Sets the src attribute's value when defining the html script element.
`void` | `setStaticJavascript(java.lang.String staticJavascript)` Sets whether or not to generate the static JavaScript.

Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent`

Methods inherited from class javax.servlet.jsp.tagext.TagSupport
`findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.servlet.jsp.tagext.Tag
`getParent, setPageContext, setParent`

Field Detail

### bundle

    protected java.lang.String bundle

  The servlet context attribute key for our resources.

### defaultLocale

    protected static java.util.Locale defaultLocale

  Deprecated. This variable is no longer used.

  The default locale on our server.

### formName

    protected java.lang.String formName

  The name of the form that corresponds with the action name in struts-config.xml. Specifying a form name places a <script> </script> around the javascript.

### lineEnd

    protected static java.lang.String lineEnd

  The line ending string.

### page

    protected int page

  The current page number of a multi-part form. Only valid when the formName attribute is set.

### methodName

    protected java.lang.String methodName

  This will be used as is for the JavaScript validation method name if it has a value. This is the method name of the main JavaScript method that the form calls to perform validations.

### staticJavascript

    protected java.lang.String staticJavascript

  The static JavaScript methods will only be printed if this is set to "true".

### dynamicJavascript

    protected java.lang.String dynamicJavascript

  The dynamic JavaScript objects will only be generated if this is set to "true".

### src

    protected java.lang.String src

  The src attribute for html script element (used to include an external script resource). The src attribute is only recognized when the formName attribute is specified.

### htmlComment

    protected java.lang.String htmlComment

  The JavaScript methods will enclosed with html comments if this is set to "true".

### cdata

    protected java.lang.String cdata

  Hide JavaScript methods in a CDATA section for XHTML when "true".

### htmlBeginComment

    private java.lang.String htmlBeginComment

### htmlEndComment

    private java.lang.String htmlEndComment

Constructor Detail

### JavascriptValidatorTag

    public JavascriptValidatorTag()

Method Detail

### getFormName

    public java.lang.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(java.lang.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 java.lang.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(java.lang.String methodName)

  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.

### getStaticJavascript

    public java.lang.String getStaticJavascript()

  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(java.lang.String 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.

### getDynamicJavascript

    public java.lang.String getDynamicJavascript()

  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(java.lang.String 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.

### getHtmlComment

    public java.lang.String getHtmlComment()

  Gets whether or not to delimit the JavaScript with html comments. If this is set to 'true', which is the default, the htmlComment will be surround the JavaScript.

### setHtmlComment

    public void setHtmlComment(java.lang.String htmlComment)

  Sets whether or not to delimit the JavaScript with html comments. If this is set to 'true', which is the default, the htmlComment will be surround the JavaScript.

### getSrc

    public java.lang.String getSrc()

  Gets the src attribute's value when defining the html script element.

### setSrc

    public void setSrc(java.lang.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.

### doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException

  Render the JavaScript for to perform validations based on the form name.

  Specified by:
    `doStartTag` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `doStartTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### release

    public void release()

  Release any acquired resources.

  Specified by:
    `release` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `release` in class `javax.servlet.jsp.tagext.BodyTagSupport`

### getJavascriptBegin

    protected java.lang.String getJavascriptBegin(java.lang.String methods)

  Returns the opening script element and some initial javascript.

### getJavascriptStaticMethods

    protected java.lang.String getJavascriptStaticMethods(org.apache.commons.validator.ValidatorResources resources)

### getJavascriptEnd

    protected java.lang.String getJavascriptEnd()

  Returns the closing script element.

### getNextVar

    private java.lang.String getNextVar(java.lang.String input)

  The value `null` will be returned at the end of the sequence. ex: "zz" will return `null`

### replaceChar

    private java.lang.String replaceChar(java.lang.String input,
                                         int pos,
                                         char c)

  Replaces a single character in a `String`

### getStartElement

    private java.lang.String getStartElement()

  Constructs the beginning <script> element depending on xhtml status.

### isXhtml

    private boolean isXhtml()

  Returns true if this is an xhtml page.

### getCdata

    public java.lang.String getCdata()

  Returns the cdata setting "true" or "false".

  Returns:
    String - "true" if JavaScript will be hidden in a CDATA section

### setCdata

    public void setCdata(java.lang.String cdata)

  Sets the cdata status.

  Parameters:
    `cdata` - The cdata to set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 - Apache Software Foundation