使用文件包含include指令

index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>使用文件包含include指令</title>
</head>
<body style="margin:0px;">
<div align="center">
<jsp:include page="top.jsp"></jsp:include>
<table width="780" height="205" border="0" cellpadding="0" cellspacing="0" background="images/center.jpg">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<jsp:include page="copyright.jsp"></jsp:include>
</div>
</body>
</html>


top.jsp

<%@ page pageEncoding="UTF-8"%>
<img src="images/banner.jpg">

copyright.jsp

<%@ page pageEncoding="UTF-8"%>
<table width="780" height="102" border="0" cellpadding="0" cellspacing="0" background="images/copyright.jpg">
  <tr>
    <td></td>
  </tr>
</table>

运行效果 http://115.29.139.162:8080/WebContent/004/

你可能感兴趣的:(使用文件包含include指令)