public class JavascriptValidatorTag
extends javax.servlet.jsp.tagext.BodyTagSupport
ValidatorPlugIn
defined in
the struts-config.xml file.Modifier and Type | Field and Description |
---|---|
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 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 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 |
htmlComment
The JavaScript methods will enclosed with html comments if this is set
to "true".
|
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".
|
Constructor and Description |
---|
JavascriptValidatorTag() |
Modifier and Type | Method and Description |
---|---|
int |
doStartTag()
Render the JavaScript for to perform validations based on the form
name.
|
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(org.apache.commons.validator.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.
|
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.
|
doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
protected static final String HTML_BEGIN_COMMENT
protected static final String HTML_END_COMMENT
protected static String lineEnd
protected String bundle
protected String formName
protected String jsFormName
protected int page
protected String methodName
protected boolean scriptLanguage
protected String staticJavascript
protected String dynamicJavascript
protected String src
protected String htmlComment
protected String cdata
public String getFormName()
public void setFormName(String formName)
public String getJsFormName()
public void setJsFormName(String jsFormName)
jsFormName
- The jsFormName to set.public int getPage()
public void setPage(int page)
public String getMethod()
public void setMethod(String methodName)
public String getStaticJavascript()
public void setStaticJavascript(String staticJavascript)
public String getDynamicJavascript()
public void setDynamicJavascript(String dynamicJavascript)
public String getHtmlComment()
public void setHtmlComment(String htmlComment)
public String getSrc()
public void setSrc(String src)
public String getBundle()
public void setBundle(String bundle)
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredprotected String renderJavascript() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
public void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.BodyTagSupport
protected String getJavascriptBegin(String methods)
protected String getJavascriptStaticMethods(org.apache.commons.validator.ValidatorResources resources)
protected String getJavascriptEnd()
protected String renderStartElement()
public String getCdata()
public void setCdata(String cdata)
cdata
- The cdata to setpublic boolean getScriptLanguage()
public void setScriptLanguage(boolean scriptLanguage)
Copyright © 2000–2016 Apache Software Foundation. All rights reserved.