前端笔记-thymeleaf获取及回显input标签type=radio
生活随笔
收集整理的這篇文章主要介紹了
前端笔记-thymeleaf获取及回显input标签type=radio
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如下演示:
回顯:
前端代碼如下:
<div class="form-group"><label>性別</label><br/><div class="form-check form-check-inline"><input class="form-check-input" type="radio" name="sex" value="1"th:checked="${people!=null}?${people.sex==1}" /><label class="form-check-label">男</label></div><div class="form-check form-check-inline"><input class="form-check-input" type="radio" name="sex" value="0"th:checked="${people!=null}?${people.sex==0}" /><label class="form-check-label">女</label></div> </div>如上可以知道這兩個input name都是一樣的 一個value是1,一個是0,他們的type都是radio,
回顯通過checked來判斷
后端獲取只要獲取sex的即可:
@RequestPara("sex") Integer sex。
這里直接使用Integer進行接收即可。
?
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的前端笔记-thymeleaf获取及回显input标签type=radio的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HTTP之Content-Securit
- 下一篇: C++笔记-使用sprintf把各个类型