如何动态禁用html< select>在JSTL中? [英] How to dynamically disable html <select> in JSTL?
本文介绍了如何动态禁用html< select>在JSTL中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用
<select id="_${sec_field}_id" name="${sec_field}" multiple="${multiple}" "${(empty disabled) ? 'disabled' : ' '}" >
要动态启用/禁用<select>
选项
但是Eclipse给了我警报:
But Eclipse give me the alerts:
Multiple annotations found at this line:
- Element type "select" must be followed by either attribute specifications, ">" or "/>".
- Attribute """ has no value
那么有什么解决方案可以解决JSTL中禁用html <select>
的问题吗?
So is there any solution that we can work out the disable of html <select>
in JSTL?
谢谢.
推荐答案
删除显示出disabled
属性名称的EL表达式周围的双引号.只能在属性 value 周围(=
之后的部分)放置双引号.
Remove those doublequotes around the EL expression which prints the disabled
attribute name. Doublequotes should be placed around the attribute value only (the part after =
).
<select ... ${empty disabled ? 'disabled' : ''}>
否则,您最终会得到
<select ... "">
或
<select ... "disabled">
在语法上是错误的.
这篇关于如何动态禁用html< select>在JSTL中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文