最新评论 thymeleaf标签 th:each的使用

 <select id="materialFlag" name="materialFlag" lay-verify="required" class="form-control ">
                                          <option>请选择类型</option>  
                                          <if th:if="${materialInout.materialFlag}==1">
                                            <option  selected="true"     th:value="1" th:text="入库"> 
                                            </option> 
                                              <option   th:value="2" th:text="出库"> 
                                            </option>
                                           </if>
                                           <if th:if="${materialInout.materialFlag}==2">
                                            <option       th:value="1" th:text="入库"> 
                                            </option> 
                                              <option  selected="true"  th:value="2" th:text="出库"> 
                                            </option>
                                           </if>
                                       </select> 

<select id="hallId" name="hallId" lay-verify="required" class="form-control ">
                                        <option th:each="hall : ${hallList}" th:value="${hall.hallId}"
                                            th:text="${hall.hallName}"
                                            th:selected="${hall.hallId }==${materialInout.hallId}"></option>
                                        
                                 </select>

猜你喜欢

转载自blog.csdn.net/weixin_41722928/article/details/81216805