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.