我有一個非常基本的Spring項目,它使用JSTL和jsp作爲視圖,當我在頁面上包含JSTL標記時,我開始收到一個404
錯誤。它工作正常,沒有標籤。爲什麼在庫中需要一些罐子,有些不在戰爭中?
This後建議包括在WEB-INF \ lib目錄下,它解決了我的問題,這有一定道理的JSTL罐子......但是我在想,爲什麼不只有這個jar需要添加到lib目錄?還有其他的依賴關係不是必需的。
所有依賴項都由Maven管理。
以下是項目結構,顯示了所用的所有庫。
而且pom.xml中......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SpringClient</groupId>
<artifactId>Client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- http://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Included because as a dependency of spring -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- http://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
正如你所看到的,JSTL罐子在兩個地方目前已經上市,爲什麼是這個必要嗎?
請發表你的pom.xml – Jaiwo99
如果您必須手動將文件放到'WEB-INF/lib'比你一個不@ Jaiwo99與Maven ... – khmarbaise
管理你的依賴謝謝,增加了pom – Continuity8