开发者

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.

Here is my code

   <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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜