<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # JSP 帶參數的`include`動作 > 原文: [https://beginnersbook.com/2013/12/jsp-include-with-parameter-example/](https://beginnersbook.com/2013/12/jsp-include-with-parameter-example/) 之前我們已經分享了如何使用[`include`指令](https://beginnersbook.com/2013/11/jsp-include-directive/)和 [`include`動作](https://beginnersbook.com/2013/11/jsp-include-action-tag/) 標簽將頁面包含到另一個 JSP 頁面。我們還討論了`include`指令和`include`動作標簽之間的[區別](https://beginnersbook.com/2013/12/difference-between-include-directive-and-include-tag-in-jsp/) 。在這篇文章中,我們將看到如何在使用 jsp `include`動作標簽(`<jsp:include>`)時將參數傳遞給包含的頁面。為了傳遞參數,我們需要使用`<jsp:param>`動作標簽。 ## 例 在這個例子中,我們使用<jsp:include>`動作標簽將 JSP 頁面(`file.jsp`)包含到主 JSP 頁面(`index.jsp`)中。要將參數從索引傳遞到文件頁面,我們使用`<jsp:param>`動作標簽。我們傳遞了三個參數`firstname`,`middlename`和`lastname`,對于每個參數我們需要指定相應的參數名稱和參數值。我們可以使用表達式語言或表達式標簽和隱含的對象。 `index.jsp` ```html <html> <head> <title>JSP include with parameters example</title> </head> <body> <jsp:include page="file.jsp" > <jsp:param name="firstname" value="Chaitanya" /> <jsp:param name="middlename" value="Pratap" /> <jsp:param name="lastname" value="Singh" /> </jsp:include> </body> </html> ``` `file.jsp` ```html ${param.firstname}<br> ${param.middlename}<br> ${param.lastname} ``` **輸出:** ![jsp-param-action](https://img.kancloud.cn/0f/74/0f7472801d90b9ddb804575f1396270d_478x162.jpg) 如您所見,包含的頁面顯示了從主頁面傳遞的參數值。為了在 `file.jsp`頁面上顯示參數,我們使用了[表達式語言(`${}`)](https://beginnersbook.com/2013/11/jsp-expression-language-el/)。但是,您也可以使用以下代碼,該代碼使用 JSP [表達式標簽](https://beginnersbook.com/2013/11/jsp-expression-tag/)和[`request`隱式對象](https://beginnersbook.com/2013/11/jsp-implicit-object-request-with-examples/)。 ```html <%= request.getParameter("firstname")%> <%= request.getParameter("middlename")%> <%= request.getParameter("lastname")%> ``` 這就是我們對這個話題的全部看法。在接下來的文章中,我們將討論如何使用`include`指令將參數及其值傳遞到另一個頁面。同時,如果您有任何疑問,請在下面的評論部分中提出相同的問題。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看