|
|
Web Hosting Glossary - Java Server Pages (JSP) Directives"
JSP directives
JSP directives control how the JSP compiler generates the servlet. The following directives are available:
- include – The include directive informs the JSP compiler to include a complete file into the current file. It is as if the contents of the included file were pasted directly into the original file. This functionality is similar to the one provided by the C preprocessor.
<%@ include file="somefile.ext" %>
- page – There are several options to the page directive.
- import results in a java import statement being inserted into the resulting file
- contentType specifies the content that is generated. This should be used if HTML is not used or if the character set is not the default character set.
- errorPage indicates the page that will be shown if an exception occurs while processing the HTTP request.
- isErrorPage if set to true, it indicates that this is the error page.
- isThreadSafe indicates if the resulting servlet is thread safe.
- <%@ page import="java.util.*" %> //example import
- <%@ page contentType="text/html" %> //example contentType
- <%@ page isErrorPage=false %> //example for non error page
- <%@ page isThreadSafe=true %> //example for a thread safe JSP
-
Note: Only the "import" page directive can be used multiple times in the same JSP.
- taglib – The taglib directive indicates that a JSP tag library is to be used. The directive requires that a prefix be specified (much like a namespace in C++) and the URI for the tag library description.
- <%@ taglib prefix="myprefix" uri="taglib/mytag.tld" %>
|