神秘的Eclipse JSP验证错误 [英] Mysterious Eclipse JSP Validation Errors

查看:469
本文介绍了神秘的Eclipse JSP验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse(Helios)偶尔将有效的JSP内容标记为有错误。当我使用< c:if>标签。例如,在具有这个内容的JSP中:

 <%@ taglib prefix = curi =http://java.sun.com/jsp/jstl/core%> 
< html>
< body>

< c:if test =$ {1 == 1}>
something
< / c:if>

< / body>
< / html>

我编译后的问题选项卡中显示以下错误:




  • 不兼容的操作数类型String和
    int行1

  • javax.servlet.jsp.JspException不能
    被解析为类型行1

  • javax.servlet.jsp.PageContext不能
    解析为类型行1



代码运行正常。 JSP的验证是否有问题,我缺少一些明显的东西,或者这表示某些东西没有正确设置。

解决方案

基于这些意见,我最终关闭了部分JSP验证,修正了这一点。


  1. 转到Project->属性 - >验证。

  2. 单击配置工作区设置...。

  3. 取消选择JSP语法验证器的选项。您需要取消选择手册和构建

我希望我错过了一些东西,有一种方法可以解决这个问题,但我有承认JSP验证是垃圾。


Eclipse (Helios) occasionally marks valid looking JSP content as having errors. It seems like it often breaks when I use the <c:if> tag. For example, in a JSP with just this content:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>

<c:if test="${1 == 1}">
something
</c:if>

</body>
</html>

The following errors show in the "Problems" tab after I compile:

  • Incompatible operand types String and int line 1
  • javax.servlet.jsp.JspException cannot be resolved to a type line 1
  • javax.servlet.jsp.PageContext cannot be resolved to a type line 1

The code runs fine. Does the validation for JSPs have issues, am I missing something obvious, or does this indicate something isn't set up correctly.

解决方案

Based on the comments, I ended up turning off part of the JSP validation, which fixed this.

  1. Go to "Project->Properties->Validation".
  2. Click "Configure Workspace Settings...".
  3. Unselect options for JSP Syntax Validator. You need to uncheck both manual and build

I was hoping I was missing something and there was a way to fix this, but I have to concede that the JSP validation is junk.

这篇关于神秘的Eclipse JSP验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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