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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 一、內置對象 > 官方文檔:[Thymeleaf 3.0 基礎對象](https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#appendix-a-expression-basic-objects) ### 七大基礎對象: * `${#ctx}`上下文對象,可用于獲取其它內置對象。 * `${#param}`: 上下文變量。 * `${#locale}`:上下文區域設置。 * `${#request}`: HttpServletRequest對象。 * `${#response}`: HttpServletResponse對象。 * `${#session}`: HttpSession對象。 * `${#servletContext}`: ServletContext對象。 ### 用法示例 **locale對象操作:** ~~~ <div th:text="${#locale.getLanguage() + '_' + #locale.getCountry()}"></div> ~~~ **session對象操作:** ~~~ <div th:text="${session.foo}?:('zoo')"></div> <div th:text="${session.size()}"></div> <div th:text="${session.isEmpty()}"></div> <div th:text="${session.containsKey('foo')}"></div> ~~~ ![](https://img.kancloud.cn/5d/ad/5dad02a18482f94f9d3c78555f3aae68_920x247.png) 運行程序觀察 ![](https://img.kancloud.cn/ae/d5/aed5b3801b82b600d6b73d145291daf7_400x194.png) 可以看到取到了語言zh、國家CN、foo對象沒有值取的默認值zoo、session因為是空的所以size等于0、isEmpy為true、是否包含foo對象為true。 這時去添加session對象 ![](https://img.kancloud.cn/43/cf/43cf2526a86e7903437e98ed372e1973_385x122.png) ![](https://img.kancloud.cn/a4/a9/a4a92cbb07cf0de949ec95ab8f226410_894x572.png) 在執行會發現 ![](https://img.kancloud.cn/d3/62/d3623eb6bb1872631ec9b64b0db2587c_381x199.png) ## 二、 常用的工具類: > 官方文檔:[Thymeleaf 3.0 工具類](https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#appendix-b-expression-utility-objects) * `#strings`:字符串工具類 * `#lists`:List 工具類 * `#arrays`:數組工具類 * `#sets`:Set 工具類 * `#maps`:常用Map方法。 * `#objects`:一般對象類,通常用來判斷非空 * `#bools`:常用的布爾方法。 * `#execInfo`:獲取頁面模板的處理信息。 * `#messages`:在變量表達式中獲取外部消息的方法,與使用#{...}語法獲取的方法相同。 * `#uris`:轉義部分URL / URI的方法。 * `#conversions`:用于執行已配置的轉換服務的方法。 * `#dates`:時間操作和時間格式化等。 * `#calendars`:用于更復雜時間的格式化。 * `#numbers`:格式化數字對象的方法。 * `#aggregates`:在數組或集合上創建聚合的方法。 * `#ids`:處理可能重復的id屬性的方法。 ### 用法舉例: **date工具類之日期格式化** 使用默認的日期格式(toString方法) 并不是我們預期的格式:`Mon Dec 03 23:16:50 CST 2018` 此時可以通過時間工具類`#dates`來對日期進行格式化:`2018-12-03 23:16:50` ~~~ <input type="text" th:value="${#dates.format(user.createTime,'yyyy-MM-dd HH:mm:ss')}"/> ~~~ ![](https://img.kancloud.cn/14/63/1463d5ee5589f33f4eaf7a75f2a8ba40_833x114.png) ![](https://img.kancloud.cn/0f/85/0f85537e2a4ad8d84a1a06fd494d6d3b_848x102.png) ![](https://img.kancloud.cn/e7/db/e7db909bcd1c779da0848aa19b729102_736x111.png) **首字母大寫** ~~~ /* * Convert the first character of every word to upper-case */ ${#strings.capitalizeWords(str)} // also array*, list* and set* ~~~ ![](https://img.kancloud.cn/e0/40/e040824ec3af6eab90043def363c3923_834x159.png) ![](https://img.kancloud.cn/97/5b/975b8d54138f44b38c8ca559e3c11515_738x114.png) **list方法** ~~~ /* * Compute size */ ${#lists.size(list)} /* * Check whether list is empty */ ${#lists.isEmpty(list)} ~~~
                  <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>

                              哎呀哎呀视频在线观看