gpt4 book ai didi

eclipse - JSP EL(表达语言)在Eclipse中引起问题

转载 作者:行者123 更新时间:2023-12-04 13:29:55 29 4
gpt4 key购买 nike

我的系统:Ubuntu 9.10。带有Java EE 1.2.1的Eclipse 3.5.1(手动安装-不是来自synaptic)。 Web开发人员工具3.1.1

我最近采用了别人的代码(动态Web项目),并且在Eclipse中遇到了许多错误,警告和不正确的语法突出显示。我将其范围缩小为以下4行代码(创建一个新的Dynamic Web Project,然后一个新的JSP页面,并将其放在正文中):

${(1<2)? "" : "no"}
<%for (int i = 0; i < 5; i++) {%>
<div>${5}</div>
<%}%>

错误/警告/语法突出显示不正确

line1: yellow warning line under '<': Invalid character used in text string (${(1<2)? "yes" : "no"}).

line2: red error line under 'f': Multiple annotations found at this line: 1) Syntax error, insert "Finally" to complete TryStatement. 2) Syntax error, insert "}" to complete ClassBody

line2: red error line under ')': Syntax error on token ")", try expected after this token

line3: yellow warning line under 'div': No end tag (/div).

line3: yellow warning line under '<' of closing div: Multiple annotations found at this line: 1) Invalid character used in text string (${5} <%}%>). 2) Invalid character used in text string (${5} <%}%>).

line3: '/div' is black and purple (for scriptlet code?) instead of green for HTML code

line4: The opening and closing scriplet tags '<%' and '%>' are black instead of orange



该页面可以在浏览器中正常运行:您获得五次“5”。如果将第1行的空引号更改为"is",然后保存,在编辑器中关闭文件,在项目资源管理器中单击该文件>验证,然后重新打开它:所有错误/警告/不正确的语法突出显示都会消失,但第一个(无效字符)。这令人难以置信。任何想法将不胜感激。

最佳答案

Eclipse WTP很棒,但是对我来说,这个问题恰恰也是Eclipse WTP中的epic fail。他们似乎正在努力解决这个问题,但是直到那之前,我只是通过“Web”>“JSP文件”>“验证”>“滚动列表”禁用/设置以忽略工作空间首选项中与此内容相关的所有验证,并将滚动列表设置为最底部,并设置所有EL验证设置以忽略。同样,在主要Validation首选项中,取消选中与JSP相关的所有复选框。但是,这似乎并不能消除所有警告/错误,但至少可以将烦恼降到最低。

IntelliJ IDEA处理JSP/EL验证要好得多。

对我来说,这些症状使我认为WTP正在使用regexp而不是基于堆栈的解析器来验证HTML/JSP/EL。在结构化标记的情况下,这是big no-no

关于eclipse - JSP EL(表达语言)在Eclipse中引起问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1790749/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com