【问题标题】:How to dynamically disable html <select> in JSTL?如何在 JSTL 中动态禁用 html <select>?
【发布时间】:2012-06-29 02:09:10
【问题描述】:

我尝试使用

<select id="_${sec_field}_id" name="${sec_field}" multiple="${multiple}" "${(empty disabled) ? 'disabled' : ' '}" >

动态启用/禁用&lt;select&gt; 选项

但是 Eclipse 给了我警报:

Multiple annotations found at this line:
- Element type "select" must be followed by either attribute specifications, ">" or "/>".
- Attribute """ has no value

那么有什么解决方案可以解决 JSTL 中 html &lt;select&gt; 的禁用问题吗?

提前致谢。

【问题讨论】:

    标签: html spring jsp spring-mvc jstl


    【解决方案1】:

    删除打印disabled 属性名称的EL 表达式周围的双引号。双引号只能放在属性 value 周围(= 之后的部分)。

    <select ... ${empty disabled ? 'disabled' : ''}>
    

    否则你会得到

    <select ... "">
    

    <select ... "disabled">
    

    语法错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-15
      • 2019-01-22
      • 2022-01-27
      • 2018-03-23
      • 1970-01-01
      相关资源
      最近更新 更多