如何摆脱“javax.servlet.jsp”。无法将PageContext解析为“带有Eclipse的jsp页面”。

时间:2023-01-25 12:12:34

I have this weird error in a .jsp page in eclipse:

我在eclipse的.jsp页面中有一个奇怪的错误:

javax.servlet.jsp.PageContext cannot be resolved to a type

My project is a maven project imported into "as an existing maven project" into juno with m2e and m2e-wtp plugins installed.

我的项目是一个maven项目,它被导入到juno中,并安装了m2e和m2e-wtp插件。

Is this a bug of the m2e plugins ? If yes, what's a possible workaround to get rid of this error (and the red mark in the workspace explorer) ?

这是m2e插件的bug吗?如果是,可能的解决方法是如何处理这个错误(以及工作区浏览器中的红色标记)?

Otherwise, do I need to "tell" to maven that my project contains jsp pages ? And hopefully, the m2e plugin will add the right library to the classpath. If yes, how ?

否则,我是否需要“告诉”maven我的项目包含jsp页面?希望m2e插件可以将正确的库添加到类路径中。如果是,如何?

如何摆脱“javax.servlet.jsp”。无法将PageContext解析为“带有Eclipse的jsp页面”。

2 个解决方案

#1


8  

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).
That's all. Just build the project now and everything will be fine.

这个答案给出了对我有效的解。转到项目属性>目标运行时>选择运行时复选框(在我的例子中是Apache Tomcat 7)。这是所有。现在就开始做这个项目,一切都会好起来的。

#2


1  

After upgrading to Kepler and updating all plugins, the issue disapeared. It was probably a bug.

在升级到开普勒并更新所有插件后,这个问题消失了。它可能是一个bug。

#1


8  

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).
That's all. Just build the project now and everything will be fine.

这个答案给出了对我有效的解。转到项目属性>目标运行时>选择运行时复选框(在我的例子中是Apache Tomcat 7)。这是所有。现在就开始做这个项目,一切都会好起来的。

#2


1  

After upgrading to Kepler and updating all plugins, the issue disapeared. It was probably a bug.

在升级到开普勒并更新所有插件后,这个问题消失了。它可能是一个bug。