jsp param動作標籤

來源:互聯網
上載者:User

標籤:jsp   java   html   web   

param 標籤以“名字-值”對的形式為其他標籤提供附加訊息,這個標籤與jsp:include、jsp:forward、jsp:plugin標籤一起使用。

param 動作標籤

<jsp:param name=“名字”value =“指定給param的值”/>

當該標籤與jsp:include標籤一起使用時,可以將param標籤的值傳遞到include指令要載入的檔案中去,因此include動作標籤如果結合param標籤,可以在負載檔案的過程中向該檔案提供訊息。

下面這個例子是param.jsp

<%@ page contentType="text/html;charset=GB2312"%><HTML><BODY><p>負載檔案效果:    <jsp:include page="tom.jsp"><jsp:param name="computer" value="300"/></jsp:include></BODY></HTML>

下面是tom.jsp

<%@ page contentType="text/html;charset=GB2312"%><HTML><BODY><%      String str=request.getParameter("computer"); int n=Integer.parseInt(str); int sum=0; for(int i=1;i<=n;i++){      sum+=i; } %><p>從1到<%=n%>的連續和是:<BR><%=sum%></BODY></HTML>
運行效果:


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.