• <bdo id='EsDe9'></bdo><ul id='EsDe9'></ul>

      1. <tfoot id='EsDe9'></tfoot>
        <legend id='EsDe9'><style id='EsDe9'><dir id='EsDe9'><q id='EsDe9'></q></dir></style></legend>
      2. <small id='EsDe9'></small><noframes id='EsDe9'>

      3. <i id='EsDe9'><tr id='EsDe9'><dt id='EsDe9'><q id='EsDe9'><span id='EsDe9'><b id='EsDe9'><form id='EsDe9'><ins id='EsDe9'></ins><ul id='EsDe9'></ul><sub id='EsDe9'></sub></form><legend id='EsDe9'></legend><bdo id='EsDe9'><pre id='EsDe9'><center id='EsDe9'></center></pre></bdo></b><th id='EsDe9'></th></span></q></dt></tr></i><div id='EsDe9'><tfoot id='EsDe9'></tfoot><dl id='EsDe9'><fieldset id='EsDe9'></fieldset></dl></div>

        Struts - Struts 提供的 .tld 的 JSP 页面中的 Taglib 指令

        时间:2023-09-24
        • <legend id='uHKro'><style id='uHKro'><dir id='uHKro'><q id='uHKro'></q></dir></style></legend>
          • <bdo id='uHKro'></bdo><ul id='uHKro'></ul>
              <tbody id='uHKro'></tbody>
              <tfoot id='uHKro'></tfoot>
              <i id='uHKro'><tr id='uHKro'><dt id='uHKro'><q id='uHKro'><span id='uHKro'><b id='uHKro'><form id='uHKro'><ins id='uHKro'></ins><ul id='uHKro'></ul><sub id='uHKro'></sub></form><legend id='uHKro'></legend><bdo id='uHKro'><pre id='uHKro'><center id='uHKro'></center></pre></bdo></b><th id='uHKro'></th></span></q></dt></tr></i><div id='uHKro'><tfoot id='uHKro'></tfoot><dl id='uHKro'><fieldset id='uHKro'></fieldset></dl></div>
            • <small id='uHKro'></small><noframes id='uHKro'>

                1. 本文介绍了Struts - Struts 提供的 .tld 的 JSP 页面中的 Taglib 指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个基于 Struts 的应用程序.我是 Struts 的新手.我想在 JSP 页面中使用 html tags ,在 Struts 提供的 taglib 目录中指定.

                  I am developing a Struts based application. I am new to Struts. I want to use html tags , specified in a taglib directory provided by Struts, in a JSP page.

                  但是不知道怎么用.我知道如何使用 taglib 指令,但我从消息来源得知 .tld 文件在 1.2.8 版本之后已嵌入到 .jar 文件中.我使用的是 Struts 2.1.8 版.

                  But don't know how to use it. I know how to use taglib directive but I came to know from sources that the .tld file has been embedded in a .jar file after version 1.2.8. I am using Struts version 2.1.8.

                  我不知道 struts-html.tld 文件位于哪个 .jar 文件中.

                  I don't know in which .jar file the struts-html.tld file is located.

                  推荐答案

                  我正在使用 Struts 1.3.10 进行此插图:

                  I'm using Struts 1.3.10 for this illustration:

                  1. 在此处下载最新的 struts 库 (http://struts.apache.org/download.cgi#struts1310).请记住,完整分发是您必须下载的内容,因为它包含带有 Struts TLD 的 war 文件.
                  2. 在您的 Web 应用程序中,将您下载的存档文件中的所有 lib 复制到您的 /WEB-INF/lib 文件夹中.
                  3. 对于 JSTL 库(适用于 struts),请访问此处(http://java.sun.com/products/jsp/jstl/)
                  4. 一旦您拥有 Struts TLD 和 JSTL Tld,请将它们放在 /WEB-INF/tld/ 文件夹下(它必须位于/WEB-INF/文件夹).
                  5. 在 web.xml 上添加以下内容(在 <web-app> 元素下)

                  1. Download the latest struts library here (http://struts.apache.org/download.cgi#struts1310). Remember, the Full Distribution is that what you have to download as it contains a war file with the Struts TLD's.
                  2. On your web application, copy all the lib in the archive file you downloaded to your /WEB-INF/lib folder.
                  3. For JSTL libraries (which works well with struts) go here (http://java.sun.com/products/jsp/jstl/)
                  4. Once you have your Struts TLD's and JSTL Tld's, put them under the /WEB-INF/tld/ folder (it must be situated in the /WEB-INF/ folder).
                  5. On web.xml add the following stuff (under the <web-app> element)

                    <jsp-config>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/sslext.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/sslext.tld</taglib-location>
                      </taglib>
                      <taglib>
                          <taglib-uri>/WEB-INF/struts-layout.tld</taglib-uri>
                          <taglib-location>/WEB-INF/tld/struts-layout.tld</taglib-location>
                      </taglib>
                  
                      <!-- Sun's JSTL -->
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/fn</taglib-uri>
                          <taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/fmt-1-0</taglib-uri>
                          <taglib-location>/WEB-INF/tld/fmt-1_0.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/fmt-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/fmt-1-0-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/fmt-1_0-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
                          <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/core-1-0</taglib-uri>
                          <taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/c-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/core-1-0-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/c-1_0-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
                          <taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/sql-1-0</taglib-uri>
                          <taglib-location>/WEB-INF/tld/sql-1_0.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/sql-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/sql-1-0-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/sql-1_0-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
                          <taglib-location>/WEB-INF/tld/x.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/x-1-0</taglib-uri>
                          <taglib-location>/WEB-INF/tld/x-1_0.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/x-rt.tld</taglib-location>
                      </taglib>
                  
                      <taglib>
                          <taglib-uri>http://java.sun.com/jstl/x-1-0-rt</taglib-uri>
                          <taglib-location>/WEB-INF/tld/x-1_0-rt.tld</taglib-location>
                      </taglib>
                  </jsp-config>
                  

                  这表明一旦你从 JSP 调用你的 TLD,你的 webapp 将寻找匹配的 然后在 上寻找它的位置. 并找到要调用的相关类.

                  This tells that once you call your TLD from the JSP, your webapp will look for the matching <taglib-uri> then look for it's location on <taglib-location> and find relevant class to call.

                  在您的 JSP 上,现在您可以这样做:

                  On your JSP, now you can do this:

                  <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
                  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
                  <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
                  <%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout"%>
                  <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
                  <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
                  <%@ taglib uri="http://java.sun.com/jstl/fn" prefix="fn" %>
                  

                  希望这会有所帮助.

                  这篇关于Struts - Struts 提供的 .tld 的 JSP 页面中的 Taglib 指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在字符串数组中获取 Logger 值 下一篇:Jsp Struts2中Action类的调用函数

                  相关文章

                  <legend id='Fjfwh'><style id='Fjfwh'><dir id='Fjfwh'><q id='Fjfwh'></q></dir></style></legend>
                  • <bdo id='Fjfwh'></bdo><ul id='Fjfwh'></ul>

                    <i id='Fjfwh'><tr id='Fjfwh'><dt id='Fjfwh'><q id='Fjfwh'><span id='Fjfwh'><b id='Fjfwh'><form id='Fjfwh'><ins id='Fjfwh'></ins><ul id='Fjfwh'></ul><sub id='Fjfwh'></sub></form><legend id='Fjfwh'></legend><bdo id='Fjfwh'><pre id='Fjfwh'><center id='Fjfwh'></center></pre></bdo></b><th id='Fjfwh'></th></span></q></dt></tr></i><div id='Fjfwh'><tfoot id='Fjfwh'></tfoot><dl id='Fjfwh'><fieldset id='Fjfwh'></fieldset></dl></div>

                  1. <small id='Fjfwh'></small><noframes id='Fjfwh'>

                    1. <tfoot id='Fjfwh'></tfoot>