<form action="/admin/student/addsave" enctype="multipart/form-data" method="post" class="addform" th:object="${student}"> <li> <label>姓名:</label> <input type="text" th:field="*{names}"> </li> <li> <label>性別:</label> <input type="radio" name="sex" value="男" th:checked="*{sex=='男'}">男 <input type="radio" name="sex" value="女" th:checked="*{sex=='女'}">女 </li> <li> <label>血型:</label> <select name="blood"> <option value="A" th:selected="*{blood=='A'}">A型</option> <option value="B" th:selected="*{blood=='B'}">B型</option> <option value="AB" th:selected="*{blood=='AB'}">AB型</option> <option value="O" th:selected="*{blood=='O'}">O型</option> </select> </li> <li> <label>愛好:</label> <input type="checkbox" name="hobby" value="籃球" th:checked="*{#strings.contains(hobby,'籃球')}">籃球 <input type="checkbox" name="hobby" value="足球" th:checked="*{#strings.contains(hobby,'足球')}">足球 <input type="checkbox" name="hobby" value="排球" th:checked="*{#strings.contains(hobby,'排球')}">排球 <input type="checkbox" name="hobby" value="網(wǎng)球" th:checked="*{#strings.contains(hobby,'網(wǎng)球')}">網(wǎng)球 </li> <li> <label>介紹:</label> <script id="intro" name="intro" type="text/plain">[(*{intro})]</script> <!--[(*{intro})]原樣顯示, 不轉(zhuǎn)義--> <!-- 配置文件 --> <script type="text/javascript" src="/vendor/ueditor/ueditor.config.js"></script> <!-- 編輯器源碼文件 --> <script type="text/javascript" src="/vendor/ueditor/ueditor.all.js"></script> <!-- 實例化編輯器 --> <script type="text/javascript"> var ue = UE.getEditor('intro'); </script> </li> <li> <label>照片:</label> <input type="file" name="myfile"> <div th:if="*{pic ne ''}"> <img th:src="'/' + *{pic}" style="max-width: 150px;"> </div> </li> <li> <input type="hidden" name="id" th:value="*{id}"> <input type="submit" value="提交"> </li>
效果如下: