- java.lang.Object
-
- javax.servlet.jsp.tagext.TagLibraryValidator
-
- javax.servlet.jsp.jstl.tlv.ScriptFreeTLV
-
public class ScriptFreeTLV extends TagLibraryValidator
A TagLibraryValidator for enforcing restrictions against the use of JSP scripting elements.
This TLV supports four initialization parameters, for controlling which of the four types of scripting elements are allowed or prohibited:
- allowDeclarations: if true, indicates that declaration elements are not prohibited.
- allowScriptlets: if true, indicates that scriptlets are not prohibited
- allowExpressions: if true, indicates that top-level expression elements (i.e., expressions not associated with request-time attribute values) are not prohibited.
- allowRTExpressions: if true, indicates that expression elements associated with request-time attribute values are not prohibited.
The default value for all for initialization parameters is false, indicating all forms of scripting elements are to be prohibited.
- Author:
- Mark A. Kolb, Shawn Bayern (minor changes)
-
-
Constructor Summary
Constructors Constructor and Description ScriptFreeTLV()
Constructs a new validator instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
setInitParameters(Map<String,Object> initParms)
Sets the values of the initialization parameters, as supplied in the TLD.ValidationMessage[]
validate(String prefix, String uri, PageData page)
Validates a single JSP page.-
Methods inherited from class javax.servlet.jsp.tagext.TagLibraryValidator
getInitParameters, release
-
-
-
-
Constructor Detail
-
ScriptFreeTLV
public ScriptFreeTLV()
Constructs a new validator instance. Initializes the parser factory to create non-validating, namespace-aware SAX parsers.
-
-
Method Detail
-
setInitParameters
public void setInitParameters(Map<String,Object> initParms)
Sets the values of the initialization parameters, as supplied in the TLD.- Overrides:
setInitParameters
in classTagLibraryValidator
- Parameters:
initParms
- a mapping from the names of the initialization parameters to their values, as specified in the TLD.
-
validate
public ValidationMessage[] validate(String prefix, String uri, PageData page)
Validates a single JSP page.- Overrides:
validate
in classTagLibraryValidator
- Parameters:
prefix
- the namespace prefix specified by the page for the custom tag library being validated.uri
- the URI specified by the page for the TLD of the custom tag library being validated.page
- a wrapper around the XML representation of the page being validated.- Returns:
- null, if the page is valid; otherwise, a ValidationMessage[] containing one or more messages indicating why the page is not valid.
-
-
Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/servlet/jsp/jstl/tlv/scriptfreetlv.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.