JSP 3 commands

Source: Internet
Author: User

JSP 3 commands
Three commands: page, include, and taglib. Page command:

* Import: equivalent to the import Statement <% @ page import = "java. util. * "%> <% @ page import =" java. util. *, java.net. * "%> multiple page commands can be provided on a JSP page, and the import statement can be repeated. <% @ page import =" java. util. * "%> <% @ page import =" java. next. * "%>
* PageEncoding: Specifies the encoding of the current page. If pageEncoding is not specified, the default value is contentType. If neither pageEncoding nor contentType is specified, the default value is iso-8859-1 * contentType: equivalent to calling response. setContentType ("text/html; charset = xxx"); If the contentType attribute is not specified, the default value is pageEncoding; if both contentType and pageEncoding are not specified, the default value is iso-8859-1
* ErrorPage: if an exception occurs on the current page, the page jumps to the jsp page specified by errorPage. Example: <% @ page errorPage = "B. jsp "%> * isErrorPage: Specify B in the preceding example. jsp is an error page, but in B. the built-in object exception cannot be used in jsp, and B is retained. only when <% @ page isErrorPage = "true" %> is used in jsp. jsp error page. * AutoFlush: When autoFlush is set to true, it indicates that the out stream buffer is automatically refreshed when it is full. The default value is true * buffer: Specify the buffer size of the out stream. The default value is 8 KB * isELIgnored: whether the EL expression is ignored on the current JSP page. The default value is false, indicating that the EL expression is not ignored.
The page command is not commonly used. attribute: * language: the language after the current JSP is compiled! The default value is java. Currently, you can only select java * info: description of the current JSP * isThreadSafe: whether the current JSP can be accessed only by a single thread. The default value is false, indicating that concurrent access is supported * session: whether the session can be used on the current page. The default value is false, indicating that the session can be used. * Extends: Specifies the parent class of the servlet compiled by JSP!
3. jsp configuration in web. xml
*. Jsp True UTF-8 <Scripting-invalid> true </scripting-invalid>
Include command:
Syntax: <% @ include file = "page" %>
The include command is used to include the specified page! Compiled into a java file in jsp BeforeThe two jsp files are merged and then compiled into a java file.
Note:
<% @ Include file = "<% = myfile %>" %>
This cannot be compiled because myfile is a variable and its value can be determined only after java is compiled into a class. The include command needs to determine which page is included during java compilation in jsp, so...
Taglib command: The taglib command is used to import a third-party tag Library to the current jsp page.
<% @ Taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
Prefix: Specify the tag prefix. You can name this item at will.
Uri: uri (unique identifier) of a third-party tag Library)
Of course, you must first put the jar package required by the third-party tag library into the class path.

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: info-contact@alibabacloud.com 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.