param动作标记详解。

来源:互联网 发布:linux php环境搭建 编辑:程序博客网 时间:2024/06/05 05:41

param动作标记配合jsp:include、jsp:forward、jsp:plugin标记的子标记来使用。

格式:

<jsp:param name="名字" value="指定给param的值"/> 
</pre><pre name="code" class="html"><span style="font-size:14px;">param可以将标记中的值传递到动作标记将要加载的文件中,并在被夹在的文件中可以通过request.getParameter("名字")得到传递过去的值。</span>
</pre><pre name="code" class="html">示例代码:
index.jsp
<pre name="code" class="html"><%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8"%><%-- <%@ include file="file.txt" %> --%>        <jsp:include page="file.jsp">      <jsp:param name="test" value="chenhao"/>      </jsp:include ><html>  <head>    <title>这是我第一个jsp页面</title>  </head>    <body>    This is my JSP page. <br>  </body></html>


file.jsp
<%@ page language="java" import="java.util.*" contentType="text/html;charset=GB2312"%><% String a=request.getParameter("test"); %><HTML><BODY>this is what?大家好,我是<%=a %>。</BODY></HTML>






0 0
原创粉丝点击