3. Jsp directive elements
• The jsp directives are messages that tells the web container how to translate a JSP
page into the corresponding servlet.
• There are three types of directives:
1. page directive
2. include directive
3. taglib directive
• The page directive defines attributes that apply to an entire JSP page.
• Attributes of JSP page directive
1. import
2. contentType
3. extends
4. info
5. buffer
6. language
7. isELIgnored
8. isThreadSafe
9. autoFlush
10. session
11. pageEncoding
12. errorPage
13. isErrorPage
4. The page Directive:
Following is the list of attributes associated with page directive:
Attribute Purpose
buffer Specifies a buffering model for the output stream.
autoFlush Controls the behavior of the servlet output buffer.
contentType Defines the character encoding scheme.
errorPage Defines the URL of another JSP that reports on Java unchecked
runtime exceptions.
isErrorPage Indicates if this JSP page is a URL specified by another JSP page's
errorPage attribute.
extends Specifies a superclass that the generated servlet must extend
import Specifies a list of packages or classes for use in the JSP as the
Java import statement does for Java classes.
info Defines a string that can be accessed with the servlet's
getServletInfo() method.
isThreadSafe Defines the threading model for the generated servlet.
language Defines the programming language used in the JSP page.
session Specifies whether or not the JSP page participates in HTTP
sessions
isELIgnored Specifies whether or not EL expression within the JSP page will be
ignored.
isScriptingEnabled Determines if scripting elements are allowed for use.
5.
6.
7.
8.
9.
10.
11.
12. Jsp Include Directive
• The include directive is used to include the contents of any resource it may
be jsp file, html file or text file. The include directive includes the original
content of the included resource at page translation time
• Advantage of Include directive
• Code Reusability
• Syntax of include directive
• <%@ include file="resourceName" %>
13. JSP Taglib directive
• The JSP taglib directive is used to define a tag library that defines many
tags. We use the TLD (Tag Library Descriptor) file to define the tags. In the
custom tag section we will use this tag so it will be better to learn it in
custom tag.
• Syntax JSP Taglib directive
• <%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>
14. Jsp Action Elements
• JSP Action Tags
• There are many JSP action tags or elements. Each JSP action tag is used
to perform some specific tasks.
• The action tags are used to control the flow between pages
If plugin is not working
15.
16.
17.
18. Jsp param
• The <jsp:param> action is used to provide information in the form of
key/value pair.
• This action can be used as direct child element of the following
actions: <jsp:include>, <jsp:forward> and <jsp:params> (which is a child
element of the <jsp:plugin> action).
• The JSP compiler will issue a translation error if this element is used
elsewhere.
• Syntax
• The <jsp:param> action has pretty simple and straightforward syntax:
• <jsp:param name="paramName" value="paramValue" />
• Both of the attributes paramName and paramValue are mandatory, and
the paramValue can accept a runtime expression.
• For the <jsp:include> and <jsp:forward> actions, the parameters will be
added to the request object of the included page and forwarded page