JSP (7) -- JSP ctictives

Source: Internet
Author: User
Tags date now

In the previous tutorial, we used Java. util. Date. Someone may ask: why not only use import java. util? In fact, the import statement can also be used in JSPs, but its syntax is somewhat different from that of common Java. The following is an example:

<% @ Page import = "Java. util. *" %>

<HTML>

<Body>

<%

System. Out. println ("Evaluating date now ");

Date = new date ();

%>

Hello! The time is now <% = date %>

</Body>

</Html>

The aboveCodeIn the first line, we call a "directive ". This jsp "directive" starts with the <% @ character. This is a "Page ctictive ". This "Page ctictive" can contain all introduced projects. If you want to introduce more than one project, you can use commas (,) to separate projects. For example:

<% @ Page import = "Java. util. *, java. Text. *" %>

There can be multiple JSP ctives Ves in "Page ctictive. In addition to "Page ctictive", other useful ves include and taglib. In the subsequent tutorial, we will discuss taglib in detail. Here we will only discuss include direve ve.

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.