jsp包含文件的两种方法


 1 //第一种:include指令:当JSP转换成Servlet时引入指定文件 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>    
 2 <%@ include file="head.jsp"%>   
 3 <%@ include file="body.jsp"%>   
 4 <%@ include file="tail.jsp"%>   
 5 //第二种:<jsp:include>动作元素:当JSP页面被请求时引入指定文件    
 6 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>   
 7 <jsp:include page="head.jsp"/>   
 8 <jsp:include page="body.jsp"/>   
 9 <jsp:include page="tail.jsp"/>   
10   
11   
12 //第二种方法可以很方便的用<jsp:param>来向所包含页传递参数,方法如下:    
13 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>   
14 <jsp:include page="head.jsp"/>   
15 <jsp:include page="body.jsp">   
16 <jsp:param name="uid" value="username"/>   
17 <jsp:param name="pwd" value="password"/>   
18 </jsp:include>   
19 <jsp:include page="tail.jsp"/>   


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM