How to disable html button using JSTL tags
I want disable HTML button depending on value present in Spring bean.I am using JSTL empty
property but no luck.
<input type="submit" value="SendEmail" disabled="${empty reportNotificationFbo.providersList}" >
Here reportNotificationFbo
is spring bean and providersList
is a list.
I want 开发者_如何学Pythonto disable Submit
button if providersList
is empty.
-Thanks.
State of the button is controlled by the presence of disabled
attribute, not by its value. Try the following:
<input type="submit" value="SendEmail"
"${(empty reportNotificationFbo.providersList) ? 'disabled' : ''}" >
If you have a disabled
attribute with any value it will be rendered in the browser as disabled
Try
<c:choose>
<c:when test="${empty reportNotificationFbo.providersList}">
<input type="submit" value="SendEmail" disabled="disabled" >
</c:when>
<c:otherwise>
<input type="submit" value="SendEmail" >
</c:otherwise>
</c:choose>
Sorry i haven't checked this code
精彩评论