Java include指令 使用示例

Java include指令 使用示例_第1张图片

<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    
  </head>
  <body>
  	<!-- 引入 header  -->
    <%@include file="/WEB-INF/main/header.jsp" %>
    <!-- 主体内容 -->
   	<div style="border:solid 1px green; height: 50px; width: 300px;">
   		主要的内容2
   	</div>
   	<!-- 引入footer -->
    <%@include file="/WEB-INF/main/footer.jsp" %>
  </body>
</html>

<%@ page contentType="text/html;charset=UTF-8" %>
我的主页 | 新闻头条 | 电 视 剧 | 最新电影

<%@ page contentType="text/html;charset=UTF-8" %>
 关于我们 | 安全保障 | All Rights Reserved2


index_jsp.java
out.write("\r\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
out.write("<html>\r\n");
out.write("  <head>\r\n");
out.write("\t<meta http-equiv=\"pragma\" content=\"no-cache\"><meta http-equiv=\"cache-control\" content=\"no-cache\"><meta http-equiv=\"expires\" content=\"0\">    \r\n");
out.write("  </head>\r\n");
out.write("  <body>\r\n");
out.write("  \t<!-- 引入 header  -->\r\n");
out.write("    ");
out.write("\r\n");
out.write("我的主页 | 新闻头条 | 电 视 剧 | 最新电影\r\n");
out.write("\r\n");
out.write("    <!-- 主体内容 -->\r\n");
out.write("   \t<div style=\"border:solid 1px green; height: 50px; width: 300px;\">\r\n");
out.write("   \t\t主要的内容2\r\n");
out.write("   \t</div>\r\n");
out.write("   \t<!-- 引入footer -->\r\n");
out.write("    ");
out.write("\r\n");
out.write(" 关于我们 | 安全保障 | All Rights Reserved2\r\n");
out.write("\r\n");
out.write("  </body>\r\n");
out.write("</html>\r\n");


你可能感兴趣的:(java,include指令,使用示例)