问题描述
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验证,修正了这一点。
- 转到Project->属性 - >验证。
- 单击配置工作区设置...。
- 取消选择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 andint line 1
- javax.servlet.jsp.JspException cannotbe resolved to a type line 1
- javax.servlet.jsp.PageContext cannotbe 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.
- Go to "Project->Properties->Validation".
- Click "Configure Workspace Settings...".
- 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验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!