Jsp: directive. page import = "" usage and explanation

Source: Internet
Author: User

In JSP web pages, we often introduce some packages or required classes. At this time, import is required, but import has different usage, among which jsp: directive. the usage and interpretation of page import = "" are as follows:

The code is as follows: Copy code

<Jsp: directive. page import = "zero. space. ch03.BookBean"/>

Equivalent

The code is as follows: Copy code
<% @ Page import = "zero. space. ch03.BookBean" %>

But there are also differences: the two uses have different scopes,

The code is as follows: Copy code
<% @ Page import = "zero. space. ch03.BookBean" %>

 

Can be used in multiple pages

The code is as follows: Copy code
<Jsp: directive. page import = "zero. space. ch03.BookBean"/>

It can only be used for one page and cannot be called across pages.
For example, if you include all the class packages in one JSP, you can include the jsp in other jsp. In this case, the introduced class must adopt

The code is as follows: Copy code
<% @ Page import = "zero. space. ch03.BookBean" %>

This statement.

The code is as follows: Copy code
<Jsp: directive. page import = "zero. space. ch03.BookBean"/>

 
This method can only be used on the same jsp page and cannot be called across pages.

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.