Three main instructions for JSP

Source: Internet
Author: User

Three commands: page directive, include directive and taglib instruction. Page directive:
* Import: Equivalent to import statement   <%@ page import= "java.util.*"%>  <%@ page import= "java.util.*,*"%&G t;  can give multiple page directives in a JSP page, and import can be repeated   <%@ page import= "java.util.*"%>  <%@ page import= "*"%> * pageencoding: Specifies the encoding of the current page   If pageencoding is not specified, the default is ContentType value;  If neither pageencoding nor ContentType are specified, the default value is iso-8859-1  * ContentType: Equals and calls Response.setcontenttype ("text/ Html;charset=xxx ");  if the ContentType attribute is not specified, the default is pageencoding value;  if contenttype and pageencoding are not specified, The default value is iso-8859-1 * errorpage: If an exception is present on the current page, jump to the JSP page specified errorpage. For example: <%@ page errorpage= "b.jsp"%>* iserrorpage: The above example specifies b.jsp as the error page, but cannot use built-in object b.jsp in exception, keep b.jsp in use <%@ Page iserrorpage= "true"%> to use the error page in b.jsp. * AutoFlush: When AutoFlush is true, indicates that the out stream buffer is automatically refreshed when it is full. The default is true* buffer: Specify the size of the out stream, default to 8kb* iselignored: Whether the current JSP page ignores the EL expression, the default is false, which means that the EL expression is not ignored
page directives infrequently used properties: * Language: The current JSP compiled language! The default is Java, currently can only select Java* Info: Description of the current JSP * IsThreadSafe: Whether the current JSP execution only single-threaded access, the default is False, indicating support for concurrent access * session: Whether the current page can use the session, The default is False, which indicates support for session usage. * Extends: Specifies the parent class of the servlet compiled by the JSP! 3. Configuration <jsp-config><jsp-property-group><url-pattern>*.jsp</url-pattern> <! of JSP in Web. xml --Indicates that all JSPS are configured--><el-ignored>true</el-ignored> <!--ignore El expressions--><page-encoding>utf-8 </page-encoding> <!--code for utf-8--><scripting-invalid>true</scripting-invalid> <!-- Disable Java Scripting--></jsp-property-group></jsp-config>
Include directive:
Syntax: <% @include file= "page" the%>
include directive is to include the specified page! before the JSP is compiled into a Java file, the two JSP files are merged and then compiled into a Java file.
<% @include file= "<%=myfile%>"%>
This is not compiled because myfile is a variable, its value is only in the Java codec Can be determined after being translated into class. The include directive needs to determine which page is included when the JSP compiles Java, so ...
TAGLIB directive:     The taglib directive is used to import a third-party tag library in the current JSP page
<%@ taglib prefix= "C" uri= "Http://"%>
: Specifies the label prefix, this thing can be arbitrarily named 
URI: Specifies the URI of the third-party tag library (unique identifier)
course, the third-party tag library needs to be placed in the classpath first.

Three main instructions for JSP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.