javascript - Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn.

Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn. The set of validation rules that should be generated is based on the formName attribute passed in, which should match the name attribute of the form element in the xml file.

The dynamicJavascript and staticJavascript attributes default to true, but if dynamicJavascript is set to true and staticJavascript is set to false then only the dynamic JavaScript will be rendered. If dynamicJavascript is set to false and staticJavascript is set to true then only the static JavaScript will be rendered which can then be put in separate JSP page so the browser can cache the static JavaScript.

Attribute Name Description
cdata

If set to "true" and XHTML has been enabled, the JavaScript will be wrapped in a CDATA section to prevent XML parsing. The default is "true" to comply with the W3C's recommendation.

Since: Struts 1.1

[RT Expr]
dynamicJavascript

Whether or not to render the dynamic JavaScript. Defaults to true.

formName

The key (form name) to retrieve a specific set of validation rules. If "dynamicJavascript" is set to true and formName is missing or is not recognized by the ValidatorPlugIn, a JspException will be thrown.

[RT Expr]
method

The alternate JavaScript method name to be used instead of the of the default. The default is 'validate' concatenated in front of the key (form name) passed in (ex: validateRegistrationForm).

[RT Expr]
page

The current page of a set of validation rules if the page attribute for the field element in the xml file is in use.

[RT Expr]
scriptLanguage The <script> element will not contain a language attribute when this is set to false. The default is true but this property is ignored in XHTML mode.

Since: Struts 1.2

[RT Expr]
src

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

[RT Expr]
staticJavascript

Whether or not to render the static JavaScript. Defaults to true.

htmlComment

Whether or not to enclose the javascript with HTML comments. This attribute is ignored in XHTML mode because the script would be deleted by the XML parser. See the cdata attribute for details on hiding scripts from XML parsers. Defaults to true.

[RT Expr]