I have a Spring 4.0.9 MVC application using JSPs as the view technology and Maven 3.2.5 for the build management. And I use Eclipse 4.4.1 for development and Tomcat 7.0.57 for running the application.
In the JSPs I want to use the EL expression ${pageContext.request.contextPath}
to reference the current request path. But Eclipse gives me the error:
javax.servlet.jsp.JspException cannot be resolved to a type
I added the following Maven dependency:
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
and the error disappears, but now I get some new types of warnings. Wherever I use the EL expression above, Eclipse says:
The declared exception IOException is not actually thrown by the method _elExpression7505() from type __2F_myproject_2F_src_2F_main_2F_webapp_2F_WEB_2D_INF_2F_views_2F_page_2E_jsp
And everywhere I use Spring's form:label
tag it tells me:
Unnecessary cast from Object to Object
Does anybody know how to get rid of these warnings? Do I have to use other Maven dependencies? (I've also included javax.servlet-api 3.0.1, jstl 1.2 and many more)
Edit: I do not want to globally ignore this type of warnings for all Java files. To me, this would rather be a workaround than a real solution.