Pun*_*cky 43 jsp servlets jstl maven
我在jsp页面中看到以下错误 -
javax.servlet.jsp.PageContext cannot be resolved to a type
javax.servlet.jsp.JspException cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)
我看过一篇关于此的帖子,并尝试了一些建议的事情.BalusC提供了很好的输入 - JSTL1.2和Standard.jar不能一起使用.我做了这个,它解决了一段时间的问题 - 但它再次出现.我不确定我是否还有罐头碰撞.我已经将所有jar定义为Maven中的依赖项.以下是我指定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>
Run Code Online (Sandbox Code Playgroud)
小智 64
您需要在项目中导入JSP API,这些API不包含在servlet-api中
在我的项目中,解决方案是:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
假设这是Web应用程序的pom ......
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
许多这些依赖关系应被设定提供,因为它们是由容器提供.您不应将这些与您的应用程序捆绑在一起 请参阅Maven依赖范围.不这样做可能会导致未定义的行为.
确切地提供哪些依赖项取决于容器.
| 归档时间: |
|
| 查看次数: |
86939 次 |
| 最近记录: |