Introduction to jsp commands and jsp actions and jsp tag commands

Source: Internet
Author: User

Introduction to jsp commands and jsp actions and jsp tag commands

Jsp tags are divided into jsp commands and jsp actions.

Jsp command element: the command element provides global information for the translation phase. For example, set the value of the global variable and the type of the output content, and declare the class to be referenced. Currently, there are three command elements: page, include, and taglib.

The 1.1 page command is used to define the global attributes of JSP files (habitually written at the beginning of the JSP program and must be uninstalled)

), For example: <% @ page contextType = "text/html: charset = UTF-8" %> specifies that the MIME type of the JSP page is text/html, the character set used is the UTF-8.

Page attributes include: language, import, buffer, contentType, pageEncoding, session, info, autoflush, errorPage, isErrorPage, and isThreadSafe.

Language: defines the script language to be used. The default value is java.

Import: Introduce java classes and packages to JSP pages. Use and separate classes and packages.

Buffer: Specifies the size of the cache area used by the out operation.

ContenType: defines the jsp character encoding and the page's corresponding mime type, default contentType = "text/html", charset = ISO-8859-1.

PageEncoding: The character encoding of the jsp page.

Info: Provides jsp page information.

Session: Used to set whether to use the built-in session object. The default value is true.

ErrorPage: defines the page called when an exception occurs on the page.

IsELIgnord: whether to ignore EL expressions

TrimDirectiveWhitespaces: This command can remove Extra blank lines when jsp outputs html (using EL and tag on jsp will generate a lot of spaces and empty lines ).

1.2 include command

Include: this command is used to insert a new jsp page in a static manner on the jsp page. <% @? Include file = "file name" %>. Pay attention to the following issues:

(1) the file name included after the include command cannot be a variable, and the file name cannot contain any parameters. The extension name can be jsp, html, txt, inc, etc, make sure that the inserted file is accessible and accessible.

(2) If the file name contains the path information, it must be the path relative to the current jsp webpage file. Generally, the file and the jsp page should be in the same web service directory, if the path starts with "/", the path mainly refers to the context path of the jsp application. If the path starts with the directory, the path is the current path of the JSP application.

(3) After you use the include command to insert a file, you must ensure that the newly created jsp page complies with the syntax rules.

(4) If you modify the contained file, you need to modify the current JSP file. In actual operation, you need to save it.

Related Article

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.