【问题标题】:Eclipse: JSTL Validation: Confused About Warning Message: "empty" only for collections>Eclipse:JSTL 验证:对警告消息感到困惑:“空”仅适用于集合>
【发布时间】:2013-09-12 19:46:56
【问题描述】:

我刚刚从另一个 IDE 迁移到 Eclipse 3.7.2。我正在维护一个旧版 web 应用程序。

一切都编译并运行良好。

Eclipse 给了我两个关于 JSTL 条件的验证警告。它告诉我我只能在集合上使用“空”。谷歌搜索的人也将它用于字符串。

条件

<c:if test = "${employee_record.show_pcell == 'T' && not empty employee_record.phone_contact_1 }">
    <tr>
        <td id = "fieldLabel">Personal Cell Phone:</td>
        <td>${employee_record.phone_contact_1} </td>
    </tr>
 </c:if>

employee_record 是所有字符串值的HashMap

以下是关于条件的两条警告消息。

This empty expression always evaluates to false.  Only string, maps, arrays and collection have meaningful values for the empty operator

This not will always result a value of true

【问题讨论】:

  • 如果应用程序在出现这些警告的情况下执行并运行良好,则继续工作。有时 Eclipse IDE 会在 JSP 上向我显示关于标签格式不正确或相似的奇怪警告,但它们确实是 =\
  • 您还在使用旧版本。也许更新的版本会更好。
  • 您的意思是更新版本的 Eclipse?
  • Eclipse 中的 EL 验证是一场史诗般的失败。只需禁用它。
  • 我去了 Windows > 首选项 > 验证。我没有看到标签“EL Validation”。它被标记为其他东西了吗?

标签: java eclipse jsp jstl string


【解决方案1】:

你需要进入 Window -> Preferences -> Web -> JavaServer Faces。

【讨论】:

    猜你喜欢
    • 2018-06-26
    • 1970-01-01
    • 2019-01-22
    • 1970-01-01
    • 2013-06-02
    • 2020-03-29
    • 2019-09-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多