include指令
语法:
<%@include file=“URL”%>
输出当前日期 date.jsp
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"
%>
<%
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String a = sdf.format(d);
out.println(a);
%>
测试include指令页面include_command.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>Include指令</h1>
<hr>
<%@include file="date.jsp" %>
</body>
</html>