Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of "javax.servlet.jsp.PageContext cannot be resolved to a type" in jsp page with Eclipse?

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

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.

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) ?

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 ?

enter image description here

like image 764
Samuel Rossille Avatar asked Jan 13 '23 13:01

Samuel Rossille


1 Answers

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.

like image 82
Nav Avatar answered May 01 '23 04:05

Nav