Eclipse:这些 JSP 错误是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2975168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse: What are these JSP errors?
提问by Paul
I've inherited a web application and when setting it up in Eclipse it shows errors in a particular JSP.
我继承了一个 web 应用程序,当在 Eclipse 中设置它时,它在特定的 JSP 中显示错误。
The errors have no description associated with them in the Problems view, and clicking them there takes me to the top of the JSP, where the red error underline appears halfway through the string like this:
在“问题”视图中,错误没有与它们相关联的描述,单击它们会将我带到 JSP 的顶部,其中红色错误下划线出现在字符串的中间,如下所示:
<%@ page erro[rPage="/basicError.j]sp" %>
[<%@ page import="javax.s]ervlet.ServletContext" %>
Imagine a red 'error' underline under the parts bracketed by [] (bold, etc won't show in this code segment and I can't show the code at all unless it's in a code segment, hence using [ and ].
想象一下 [] 括起来的部分下的红色“错误”下划线(粗体等不会显示在此代码段中,我根本无法显示代码,除非它在代码段中,因此使用 [ 和 ]。
Other examples of the errors:
其他错误示例:
Clicking the red 'X' icon to the left of the lines does nothing.
单击线条左侧的红色“X”图标没有任何作用。
I've tried re-importing the project, refreshing, validating, moving the lines around, etc, but I always get this error.
我试过重新导入项目、刷新、验证、移动线条等,但我总是收到此错误。
Does anyone know what's happening here?
有谁知道这里发生了什么?
回答by BalusC
Run it. Does it work? Then it's againthe Eclipse's builtin JSP validator which is an epic fail. Just disable it in workspace preferences through Web > JSP Files > Validation> scroll list to very bottom and set all EL validation settings to Ignore. Also in the main Validationpreference uncheck all checkboxes related to JSP. This however doesn't seem to remove every warning/error, but it at least minimizes the annoyance.
运行。它有效吗?然后又是 Eclipse 的内置 JSP 验证器,这是一个史诗般的失败。只需通过Web > JSP Files > Validation> scroll list 到最底部在工作区首选项中禁用它,并将所有 EL 验证设置设置为Ignore。同样在主验证首选项中,取消选中与 JSP 相关的所有复选框。然而,这似乎并没有消除每个警告/错误,但它至少可以最大限度地减少烦恼。
回答by raghavsood33
The solution that worked for me, is given in this answer.
对我有用的解决方案在这个答案中给出。
Go to project properties > Targeted runtimes > Select the checkbox for a runtime(Apache Tomcat 7 in my case).
转到项目属性 > 目标运行时 > 选择运行时的复选框(在我的例子中是 Apache Tomcat 7)。
That's all. Just build the projectnow and everything will be fine
就这样。现在只需构建项目,一切都会好起来的
回答by uneakharsh
I did try disabling the jsp validation but nothing really worked, so I tried the following and it worked.
我确实尝试过禁用 jsp 验证,但没有任何效果,所以我尝试了以下方法并且它起作用了。
- Select all the code from your jsp.
- copy it in some text editor
- delete everything from your jsp.
- Save your jsp.[All the red lines should be gone at this step].
- Copy and paste your code back in the jsp.
- Save your jsp again.
- Done.
- 从您的 jsp 中选择所有代码。
- 在一些文本编辑器中复制它
- 从您的jsp中删除所有内容。
- 保存你的jsp。[在这一步,所有的红线都应该消失了]。
- 将您的代码复制并粘贴回 jsp 中。
- 再次保存您的jsp。
- 完毕。
回答by Prasad Kothavale
Right Click your project >> Build Path >> Configure Build Path
右键单击您的项目>>构建路径>>配置构建路径
Step 1: In libraries tab you should have proper version of JRE system library(eg:JRE System Library [JRE7]) and server library(eg: Apache tomcat V7.0) If not then click add library >> JRE System library >> select installed jre version also add library >> server runtime >> select your installed server
步骤 1:在库选项卡中,您应该拥有正确版本的 JRE 系统库(例如:JRE 系统库 [JRE7])和服务器库(例如:Apache tomcat V7.0)如果没有,则单击添加库 >> JRE 系统库 >>选择已安装的 jre 版本并添加库 >> 服务器运行时 >> 选择您已安装的服务器
Step 2: Go in order and export tab make sure JRE System Library and server library is checked, click ok
第 2 步:按顺序和导出选项卡确保选中 JRE 系统库和服务器库,单击确定