thymeleaf标签整理

th:fragment 被调用的内容

<div th:fragment="prefectures">
  <select th:if="${inputValue}" id="prefecture" name="prefecture" class="select_large" size="1">
    <option th:each="job : ${prefectureInfoList}" th:value="${job.prefectureCd}" th:selected="${job.prefectureCd == inputValue.prefectureCd}" th:inline="text" th:class="${job.prefectureCd}">[[${job.prefectureNm}]]</option>
  </select>

th:include 调用元

      <td align="left"  width="50%">
        <div th:include="common/prefectures :: prefectures" style="display:inline"></div>
        <font color="RED" size="-1"><b> *必須項目</b></font>
        <input type="hidden" name="prefectureNm" id="prefectureNm" />
        <input type="hidden" name="prefectureCd" id="prefectureCd" />
      </td>

th:inline 让变量在文本框里现实 格式[[...]]


th:each 循环变量

th:each="job : ${prefectureInfoList}"

循环,job是页面侧的变量名,prefectureInfoList是java侧的变量名




猜你喜欢

转载自blog.csdn.net/weixin_37370093/article/details/78092144
今日推荐