input :
<input type="text" id="name" name="name" th:value="${user.name}" class="form-control1" >
select :
<label class="col-sm-4 control-label">類別</label>
<div class="col-sm-8">
<select id="cId" name="cId" class="form-control1" >
<option value="1" th:field="*{book.cId}">目錄1</option>
<option value="2" th:field="*{book.cId}">目錄2</option>
<option value="3" th:field="*{book.cId}">目錄3</option>
<option value="4" th:field="*{book.cId}">目錄4</option>
</select>
</div>
說明:{ } 中,變量名前後不得出現空格,如 { book.cId}、 {book.cId }、 { book.cId },將拋出模板解析錯誤 。
radio:
<label for="isDel" class="col-sm-4 control-label">是否刪除</label>
<div id="isDel" class="col-sm-8">
<div class="radio-inline">
<label><input type="radio" name="isDel" value="1" th:field="*{user.isDel}"/>已刪除</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="isDel" value="0" th:field="*{user.isDel}"/>正常</label>
</div>
</div>
說明:{ } 中不得出現空格,如 { book.cId}、 {book.cId }、 { book.cId },將報模板解析錯誤 。
textarea :
內容:
<textarea id="content" name="content" th:text="${user.content}" ></textarea>
使用 th:value 不能回顯。