如何根据jsp中的条件禁用按钮? [英] how to disable buttons based on a condition in jsp?

查看:59
本文介绍了如何根据jsp中的条件禁用按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过检查我的 jsp 中的条件来禁用按钮?如果为真,则启用该按钮,如果为假,则禁用该按钮.条件是检查变量的值.我知道如何使用 javascript 禁用按钮,但是将它与 jsp 中的条件一起使用是我无法弄清楚的.有可能吗?

how can I disable a button by checking a condition in my jsp? If true,then the button is enabled,if false,then the button is disabled. The condition would be checking the value of a variable. I know how to disable a button using javascript, but to use it along with the condition in jsp is what I'm not able to figure out. Is it at all possible?

推荐答案

尝试使用 JSTL 构造,如下所示:

Try using JSTL construction like this:

<input type="button" <c:if test="${variable == false}"><c:out value="disabled='disabled'"/></c:if>">

有关更多示例,请参见 http://www.ibm.com/developerworks/java/library/j-jstl0211/index.html

For more examples see http://www.ibm.com/developerworks/java/library/j-jstl0211/index.html

这篇关于如何根据jsp中的条件禁用按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆