在我的jsp中,对于某些条件,我希望复选框存在但不希望允许用户检查或取消选中它.
我不确定如何实现这一目标.我尝试了以下内容
<form:checkbox path="..." disabled = "disabled">
<form:checkbox path="..." disabled = "true">
<form:checkbox path="..." readonly = "readonly">
Run Code Online (Sandbox Code Playgroud)
似乎没什么用.
有人可以对此有所了解吗?
谢谢..
xyz*_*xyz 19
disabledattribute in <spring:checkbox>应设置为trueor,false而checkbox不具有readonly属性.所以
<form:checkbox path="corespondingPath" disabled = "true">
Run Code Online (Sandbox Code Playgroud)
应该管用.
很少链接
Spring doc链接.
Spring表单输入中的Readonly和Disabled属性
您可以根据某些条件使用JSTL添加它
<c:choose>
<c:when test="${condition}">
// Add checkbox with disabled="true"
<form:checkbox path="desiredPAth" disabled="true" />
</c:when>
<c:otherwise>
// Do something else
</c:otherwise>
</c:choose>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18211 次 |
| 最近记录: |