javax.servlet.jsp.PageContext无法解析为一种类型 [英] javax.servlet.jsp.PageContext cannot be resolved to a type
问题描述
我在jsp页面中看到以下错误-
I am seeing the below errors in my jsp page -
javax.servlet.jsp.PageContext cannot be resolved to a type
javax.servlet.jsp.JspException cannot be resolved to a type
我看到了有关此内容的帖子,并尝试了一些建议的方法. BalusC提供了很好的输入-不能同时使用JSTL1.2和Standard.jar.我做到了,它解决了一段时间的问题-但它再次出现.我不确定是否还有罐子碰撞.我已经将所有jar定义为Maven中的依赖项.以下是我指定的依赖项pom.xml-
I have seen a post on this and tried few things that were suggested. BalusC provided a great input - JSTL1.2 and Standard.jar must not be used together. I did this and it fixed the issue for sometime - but it is reappearing. I am not sure if I have any more jar collisions. I have defined all the jars as dependencies in Maven. The below are the dependencies that I have specified pom.xml -
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.38</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
推荐答案
您将需要在项目中导入JSP API,而servlet-api中没有这些API
You will need to import in your project the JSP APIs, which are not included in servlet-api
在我的项目中,解决方案是:
In my project, the solution is:
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
这篇关于javax.servlet.jsp.PageContext无法解析为一种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!