如何禁用spring窗体复选框?
在我的jsp中,对于某些情况,我希望复选框存在,但不希望允许用户选中或取消选中它 我不知道如何才能做到这一点。我尝试了以下方法如何禁用spring窗体复选框?,spring,jsp,Spring,Jsp,在我的jsp中,对于某些情况,我希望复选框存在,但不希望允许用户选中或取消选中它 我不知道如何才能做到这一点。我尝试了以下方法 <form:checkbox path="..." disabled = "disabled"> <form:checkbox path="..." disabled = "true"> <form:checkbox path="..." readonly = "readonly"> 似乎什么都不管用 有人能解释一下吗 谢
<form:checkbox path="..." disabled = "disabled">
<form:checkbox path="..." disabled = "true">
<form:checkbox path="..." readonly = "readonly">
似乎什么都不管用
有人能解释一下吗
谢谢。
中的禁用
属性应设置为真
或假
,并且复选框不具有只读
属性。所以
<form:checkbox path="corespondingPath" disabled = "true">
应该有用
少链接您可以根据某些条件使用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>
//使用disabled=“true”添加复选框
//做点别的
一个较短的方法是@OJVM Yes更干净。