我有一组 3 个单选按钮。用户只能选择 3 个中的 1 个。我想设置一个单选按钮作为默认选择。我试过这段代码,但检查属性似乎被忽略了。
<div>
<input type="radio" th:field="*{genre}" th:value="Strategy" checked="true">
<label th:for="${#ids.prev('genre')}">Strategy</label>
</div>
<div>
<input type="radio" th:field="*{genre}" th:value="RPG">
<label th:for="${#ids.prev('genre')}">RPG</label>
</div>
<div>
<input type="radio" th:field="*{genre}" th:value="Stealth">
<label th:for="${#ids.prev('genre')}">Stealth</label>
</div>
Run Code Online (Sandbox Code Playgroud)
public class Game
{
private String genre;
//Constructor
//Getter & Setter
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9287 次 |
| 最近记录: |