<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標準標簽庫(JSTL) JSP標準標簽庫(JSTL)是一個JSP標簽集合,它封裝了JSP應用的通用核心功能。 JSTL支持通用的、結構化的任務,比如迭代,條件判斷,XML文檔操作,國際化標簽,SQL標簽。 除了這些,它還提供了一個框架來使用集成JSTL的自定義標簽。 根據JSTL標簽所提供的功能,可以將其分為5個類別。 * **核心標簽** * **格式化標簽** * **SQL 標簽** * **XML 標簽** * **JSTL 函數** * * * ## JSTL 庫安裝 Apache Tomcat安裝JSTL 庫步驟如下: 從Apache的標準標簽庫中下載的二進包(jakarta-taglibs-standard-current.zip)。 * 官方下載地址:[http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/](http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/) * 本站下載地址:[jakarta-taglibs-standard-1.1.2.zip](http://static.runoob.com/download/jakarta-taglibs-standard-1.1.2.tar.gz) 下載**jakarta-taglibs-standard-1.1.2.zip**包并解壓,將**jakarta-taglibs-standard-1.1.2/lib/**下的兩個 jar 文件:**standard.jar**和**jstl.jar**文件拷貝到**/WEB-INF/lib/**下。 將 tld 下的需要引入的 tld 文件復制到 WEB-INF 目錄下。 接下來我們在 web.xml 文件中添加以下配置: ~~~ <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> ????<jsp-config> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri> ????<taglib-location>/WEB-INF/fmt.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/fmt-rt</taglib-uri> ????<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri> ????<taglib-location>/WEB-INF/c.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/core-rt</taglib-uri> ????<taglib-location>/WEB-INF/c-rt.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri> ????<taglib-location>/WEB-INF/sql.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/sql-rt</taglib-uri> ????<taglib-location>/WEB-INF/sql-rt.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/x</taglib-uri> ????<taglib-location>/WEB-INF/x.tld</taglib-location> ????</taglib> ????<taglib> ????<taglib-uri>http://java.sun.com/jsp/jstl/x-rt</taglib-uri> ????<taglib-location>/WEB-INF/x-rt.tld</taglib-location> ????</taglib> ????</jsp-config> </web-app> ~~~ 使用任何庫,你必須在每個 JSP 文件中的頭部包含標簽。 * * * ## 核心標簽 核心標簽是最常用的 JSTL標簽。引用核心標簽庫的語法如下: ~~~ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ~~~ | 標簽 | 描述 | | --- | --- | | [](https://www.runoob.com/jsp/jstl-core-out-tag.html) | 用于在JSP中顯示數據,就像 | | [](https://www.runoob.com/jsp/jstl-core-set-tag.html) | 用于保存數據 | | [](https://www.runoob.com/jsp/jstl-core-remove-tag.html) | 用于刪除數據 | | [](https://www.runoob.com/jsp/jstl-core-catch-tag.html) | 用來處理產生錯誤的異常狀況,并且將錯誤信息儲存起來 | | [](https://www.runoob.com/jsp/jstl-core-if-tag.html) | 與我們在一般程序中用的if一樣 | | [](https://www.runoob.com/jsp/jstl-core-choose-tag.html) | 本身只當做和的父標簽 | | [](https://www.runoob.com/jsp/jstl-core-choose-tag.html) | 的子標簽,用來判斷條件是否成立 | | [](https://www.runoob.com/jsp/jstl-core-choose-tag.html) | 的子標簽,接在標簽后,當標簽判斷為false時被執行 | | [](https://www.runoob.com/jsp/jstl-core-import-tag.html) | 檢索一個絕對或相對 URL,然后將其內容暴露給頁面 | | [](https://www.runoob.com/jsp/jstl-core-foreach-tag.html) | 基礎迭代標簽,接受多種集合類型 | | [](https://www.runoob.com/jsp/jstl-core-foreach-tag.html) | 根據指定的分隔符來分隔內容并迭代輸出 | | [](https://www.runoob.com/jsp/jstl-core-param-tag.html) | 用來給包含或重定向的頁面傳遞參數 | | [](https://www.runoob.com/jsp/jstl-core-redirect-tag.html) | 重定向至一個新的URL. | | [](https://www.runoob.com/jsp/jstl-core-url-tag.html) | 使用可選的查詢參數來創造一個URL | * * * ## 格式化標簽 JSTL格式化標簽用來格式化并輸出文本、日期、時間、數字。引用格式化標簽庫的語法如下: ~~~ <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> ~~~ | 標簽 | 描述 | | --- | --- | | [](https://www.runoob.com/jsp/jstl-format-formatnumber-tag.html) | 使用指定的格式或精度格式化數字 | | [](https://www.runoob.com/jsp/jstl-format-parsenumber-tag.html) | 解析一個代表著數字,貨幣或百分比的字符串 | | [](https://www.runoob.com/jsp/jstl-format-formatdate-tag.html) | 使用指定的風格或模式格式化日期和時間 | | [](https://www.runoob.com/jsp/jstl-format-parsedate-tag.html) | 解析一個代表著日期或時間的字符串 | | [](https://www.runoob.com/jsp/jstl-format-bundle-tag.html) | 綁定資源 | | [](https://www.runoob.com/jsp/jstl-format-setlocale-tag.html) | 指定地區 | | [](https://www.runoob.com/jsp/jstl-format-setbundle-tag.html) | 綁定資源 | | [](https://www.runoob.com/jsp/jstl-format-timezone-tag.html) | 指定時區 | | [](https://www.runoob.com/jsp/jstl-format-settimezone-tag.html) | 指定時區 | | [](https://www.runoob.com/jsp/jstl-format-message-tag.html) | 顯示資源配置文件信息 | | [](https://www.runoob.com/jsp/jstl-format-requestencoding-tag.html) | 設置request的字符編碼 | * * * ## SQL標簽 JSTL SQL標簽庫提供了與關系型數據庫(Oracle,MySQL,SQL Server等等)進行交互的標簽。引用SQL標簽庫的語法如下: ~~~ <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %> ~~~ | 標簽 | 描述 | | --- | --- | | [](https://www.runoob.com/jsp/jstl-sql-setdatasource-tag.html) | 指定數據源 | | [](https://www.runoob.com/jsp/jstl-sql-query-tag.html) | 運行SQL查詢語句 | | [](https://www.runoob.com/jsp/jstl-sql-update-tag.html) | 運行SQL更新語句 | | [](https://www.runoob.com/jsp/jstl-sql-param-tag.html) | 將SQL語句中的參數設為指定值 | | [](https://www.runoob.com/jsp/jstl-sql-dateparam-tag.html) | 將SQL語句中的日期參數設為指定的java.util.Date?對象值 | | [](https://www.runoob.com/jsp/jstl-sql-transaction-tag.html) | 在共享數據庫連接中提供嵌套的數據庫行為元素,將所有語句以一個事務的形式來運行 | * * * ## XML 標簽 JSTL XML標簽庫提供了創建和操作XML文檔的標簽。引用XML標簽庫的語法如下: ~~~ <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %> ~~~ 在使用xml標簽前,你必須將XML 和 XPath 的相關包拷貝至你的\\lib下: * **XercesImpl.jar** 下載地址:[http://www.apache.org/dist/xerces/j/](http://www.apache.org/dist/xerces/j/) * **xalan.jar** 下載地址:[http://xml.apache.org/xalan-j/index.html](http://xml.apache.org/xalan-j/index.html) | 標簽 | 描述 | | --- | --- | | [](https://www.runoob.com/jsp/jstl-xml-out-tag.html) | 與,類似,不過只用于XPath表達式 | | [](https://www.runoob.com/jsp/jstl-xml-parse-tag.html) | 解析 XML 數據 | | [](https://www.runoob.com/jsp/jstl-xml-set-tag.html) | 設置XPath表達式 | | [](https://www.runoob.com/jsp/jstl-xml-if-tag.html) | 判斷XPath表達式,若為真,則執行本體中的內容,否則跳過本體 | | [](https://www.runoob.com/jsp/jstl-xml-foreach-tag.html) | 迭代XML文檔中的節點 | | [](https://www.runoob.com/jsp/jstl-xml-choose-tag.html) | 和的父標簽 | | [](https://www.runoob.com/jsp/jstl-xml-choose-tag.html) | 的子標簽,用來進行條件判斷 | | [](https://www.runoob.com/jsp/jstl-xml-choose-tag.html) | 的子標簽,當判斷為false時被執行 | | [](https://www.runoob.com/jsp/jstl-xml-transform-tag.html) | 將XSL轉換應用在XML文檔中 | | [](https://www.runoob.com/jsp/jstl-xml-param-tag.html) | 與共同使用,用于設置XSL樣式表 | * * * ## JSTL函數 JSTL包含一系列標準函數,大部分是通用的字符串處理函數。引用JSTL函數庫的語法如下: ~~~ <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> ~~~ | 函數 | 描述 | | --- | --- | | [fn:contains()](https://www.runoob.com/jsp/jstl-function-contains.html) | 測試輸入的字符串是否包含指定的子串 | | [fn:containsIgnoreCase()](https://www.runoob.com/jsp/jstl-function-containsignoreCase.html) | 測試輸入的字符串是否包含指定的子串,大小寫不敏感 | | [fn:endsWith()](https://www.runoob.com/jsp/jstl-function-endswith.html) | 測試輸入的字符串是否以指定的后綴結尾 | | [fn:escapeXml()](https://www.runoob.com/jsp/jstl-function-escapexml.html) | 跳過可以作為XML標記的字符 | | [fn:indexOf()](https://www.runoob.com/jsp/jstl-function-indexof.html) | 返回指定字符串在輸入字符串中出現的位置 | | [fn:join()](https://www.runoob.com/jsp/jstl-function-join.html) | 將數組中的元素合成一個字符串然后輸出 | | [fn:length()](https://www.runoob.com/jsp/jstl-function-length.html) | 返回字符串長度 | | [fn:replace()](https://www.runoob.com/jsp/jstl-function-replace.html) | 將輸入字符串中指定的位置替換為指定的字符串然后返回 | | [fn:split()](https://www.runoob.com/jsp/jstl-function-split.html) | 將字符串用指定的分隔符分隔然后組成一個子字符串數組并返回 | | [fn:startsWith()](https://www.runoob.com/jsp/jstl-function-startswith.html) | 測試輸入字符串是否以指定的前綴開始 | | [fn:substring()](https://www.runoob.com/jsp/jstl-function-substring.html) | 返回字符串的子集 | | [fn:substringAfter()](https://www.runoob.com/jsp/jstl-function-substringafter.html) | 返回字符串在指定子串之后的子集 | | [fn:substringBefore()](https://www.runoob.com/jsp/jstl-function-substringbefore.html) | 返回字符串在指定子串之前的子集 | | [fn:toLowerCase()](https://www.runoob.com/jsp/jstl-function-tolowercase.html) | 將字符串中的字符轉為小寫 | | [fn:toUpperCase()](https://www.runoob.com/jsp/jstl-function-touppercase.html) | 將字符串中的字符轉為大寫 | | [fn:trim()](https://www.runoob.com/jsp/jstl-function-trim.html) | 移除首尾的空白符 |
                  <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>

                              哎呀哎呀视频在线观看