org.apache.struts.taglib.html
public class JavascriptValidatorTag extends BodyTagSupport
ValidatorPlugIn
defined in the struts-config.xml file.
Since: Struts 1.1
Version: $Rev: 383908 $ $Date: 2006-03-07 15:33:42 +0000 (Tue, 07 Mar 2006) $
Field Summary | |
---|---|
static Comparator | actionComparator
A Comparator to use when sorting ValidatorAction objects. |
protected String | bundle
The servlet context attribute key for our resources. |
protected String | cdata
Hide JavaScript methods in a CDATA section for XHTML when "true". |
protected static Locale | defaultLocale
The default locale on our server. |
protected String | dynamicJavascript
The dynamic JavaScript objects will only be generated if this is set to "true". |
protected String | formName
The name of the form that corresponds with the action name
in struts-config.xml. |
protected String | htmlComment
The JavaScript methods will enclosed with html comments if this is set to "true". |
protected static String | HTML_BEGIN_COMMENT
The start of the HTML comment hiding JavaScript from old browsers. |
protected static String | HTML_END_COMMENT
The end of the HTML comment hiding JavaScript from old browsers. |
protected String | jsFormName
formName is used for both Javascript and non-javascript validations.
|
protected static String | lineEnd
The line ending string. |
protected 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 boolean | scriptLanguage
Include language attribute in the <script> element. |
protected String | src
The src attribute for html script element (used to include an external script
resource). |
protected String | staticJavascript
The static JavaScript methods will only be printed if this is set to "true". |
Method Summary | |
---|---|
List | createActionList(ValidatorResources resources, Form form)
Get List of actions for the given Form. |
String | createDynamicJavascript(ModuleConfig config, ValidatorResources resources, Locale locale, Form form)
Generates the dynamic JavaScript for the form. |
String | createMethods(List actions, boolean stopOnError)
Creates the JavaScript methods list from the given actions. |
int | doStartTag()
Render the JavaScript for to perform validations based on the form name.
|
String | escapeJavascript(String str) Backslash-escapes the following characters from the input string: ", ', \, \r, \n. This method escapes characters that will result in an invalid Javascript statement within the validator Javascript. |
String | escapeQuotes(String in) |
String | getBundle()
Sets the servlet context attribute key for our resources. |
String | getCdata()
Returns the cdata setting "true" or "false". |
String | getDynamicJavascript()
Gets whether or not to generate the dynamic
JavaScript. |
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. |
String | getHtmlComment()
Gets whether or not to delimit the
JavaScript with html comments. |
protected String | getJavascriptBegin(String methods)
Returns the opening script element and some initial javascript. |
protected String | getJavascriptEnd()
Returns the closing script element. |
protected String | getJavascriptStaticMethods(ValidatorResources resources) |
String | getJsFormName() |
String | getMethod()
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.
|
boolean | getScriptLanguage()
Gets whether or not the <script> element will include the
language attribute. |
String | getSrc()
Gets the src attribute's value when defining
the html script element. |
String | getStaticJavascript()
Gets whether or not to generate the static
JavaScript. |
boolean | isXhtml()
Returns true if this is an xhtml page. |
void | release()
Release any acquired resources. |
protected String | renderJavascript()
Returns fully rendered JavaScript. |
protected String | renderStartElement()
Constructs the beginning <script> element depending on XHTML
status. |
void | setBundle(String bundle)
Gets the servlet context attribute key for our resources. |
void | setCdata(String cdata)
Sets the cdata status. |
void | setDynamicJavascript(String 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(String htmlComment)
Sets whether or not to delimit the
JavaScript with html comments. |
void | setJsFormName(String jsFormName) |
void | setMethod(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 | setScriptLanguage(boolean scriptLanguage)
Sets whether or not the <script> element will include the
language attribute. |
void | setSrc(String src)
Sets the src attribute's value when defining
the html script element. |
void | setStaticJavascript(String staticJavascript)
Sets whether or not to generate the static
JavaScript. |
boolean | stopOnError(ModuleConfig config)
Determines if validations should stop on an error. |
Deprecated: This variable is no longer used.
The default locale on our server.Since: Struts 1.2
Since: Struts 1.2
Since: Struts 1.2
Parameters: resources form
Returns: A sorted List of ValidatorAction objects.
Parameters: config resources locale form
Parameters: actions A List of ValidatorAction objects. stopOnError If true, behaves like released version of struts 1.1 and stops after first error. If false, evaluates all validations.
Returns: JavaScript methods.
Throws: JspException if a JSP exception has occurred
Backslash-escapes the following characters from the input string: ", ', \, \r, \n.
This method escapes characters that will result in an invalid Javascript statement within the validator Javascript.
Parameters: str The string to escape.
Returns: The string s
with each instance of a double quote,
single quote, backslash, carriage-return, or line feed escaped
with a leading backslash.
Since: Struts 1.2.8
Returns: String - "true" if JavaScript will be hidden in a CDATA section
Returns: Returns the jsFormName.
Returns: true if language attribute will be included.
Since: Struts 1.2
Since: Struts 1.2
Since: Struts 1.2
Parameters: cdata The cdata to set
Parameters: jsFormName The jsFormName to set.
Since: Struts 1.2
Parameters: config The ModuleConfig
used to lookup the
stopOnError setting.
Returns: true
if validations should stop on errors.