当前位置: 代码迷 >> JavaScript >> jsp页面包孕
  详细解决方案

jsp页面包孕

热度:497   发布时间:2012-11-23 22:54:33.0
jsp页面包含
写道
第一种:include指令:当JSP转换成Servlet时引入指定文件 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>
<%@ include file="head.jsp"%>
<%@ include file="body.jsp"%>
<%@ include file="tail.jsp"%>
第二种:<jsp:include>动作元素:当JSP页面被请求时引入指定文件
<%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>
<jsp:include page="head.jsp"/>
<jsp:include page="body.jsp"/>
<jsp:include page="tail.jsp"/>


第二种方法可以很方便的用<jsp:param>来向所包含页传递参数,方法如下:
<%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>
<jsp:include page="head.jsp"/>
<jsp:include page="body.jsp">
<jsp:param name="uid" value="username"/>
<jsp:param name="pwd" value="password"/>
</jsp:include>
<jsp:include page="tail.jsp"/>

?

  相关解决方案