<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 如何訪問自定義標簽的主體 > 原文: [https://beginnersbook.com/2014/01/how-to-access-body-of-custom-tags-in-jsp-tutorial/](https://beginnersbook.com/2014/01/how-to-access-body-of-custom-tags-in-jsp-tutorial/) 在上一個教程中,我們學習了[如何在 JSP](https://beginnersbook.com/2014/01/jsp-custom-tags-with-example-jsp-tutorial/) 中創建和使用自定義標簽。在本教程中,我們將了解如何訪問自定義標簽的主體。對于例如如果我們的自定義標簽是`xyz`,那么我們將學習訪問`<prefix: xyz>`和`</prefix:xyz>`之間的內容 ```html <prefix: xyz> Body of custom tag: This is what we will access in the below example </prefix:xyz> ``` **示例:** 在此示例或自定義標簽中,將`String`附加到其自己的主體并顯示結果。 **標簽處理程序類**:`Details.java` ```html package beginnersbook.com; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.*; import java.io.*; public class Details extends SimpleTagSupport { //StringWriter object StringWriter sw = new StringWriter(); public void doTag() throws JspException, IOException { getJspBody().invoke(sw); JspWriter out = getJspContext().getOut(); out.println(sw.toString()+"Appended Custom Tag Message"); } } ``` **TLD 文件**:`message.tld`,請記住將此文件放在`WEB-INF`文件夾中。 ```html <taglib> <tlib-version>1.0</tlib-version> <jsp-version>2.0</jsp-version> <short-name>My Custom Tag: MyMsg</short-name> <tag> <name>MyMsg</name> <tag-class>beginnersbook.com.Details</tag-class> <body-content>scriptless</body-content> </tag> </taglib> ``` **JSP 頁面**:`index.jsp` ```html <%@ taglib prefix="myprefix" uri="WEB-INF/message.tld"%> <html> <head> <title>Accessing Custom Tag Body Example</title> </head> <body> <myprefix:MyMsg> Test String </myprefix:MyMsg> </body> </html> ``` **輸出:** ```html Test String Appended Custom Tag Message ```
                  <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>

                              哎呀哎呀视频在线观看