這是我在SpringMVC中使用Maven的第一個應用程序。 這裏是應用程序結構。未找到HTTP狀態404頁。 SpringMVC錯誤
控制器代碼:
當我點擊的index.jsp的鏈接頁面要遍歷的helloWorld.jsp
的index.jsp有這樣鏈接:
<h3>
<a href="hello?name=Eric">Click Here</a>
</h3>
的helloWorld.jsp
<h2>
${message} ${name}
</h2>
用於調度的servlet代碼:
更新:web.xml文件。
據我所知,這是一個愚蠢的問題,但作爲一個新手到結構用SpringMVC,我無法找到的錯誤。請幫忙!
春天開始了。 這是主頁,當我點擊鏈接時,它應該被遍歷到helloworld.jsp。
這是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/maven-v4_0_0.xsd」>
<modelVersion>4.0.0</modelVersion>
<groupId>demoproject</groupId>
<artifactId>demoMVC</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>demoMVC Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>4.0.1.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<finalName>demoMVC</finalName>
<directory>${basedir}/target</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
</plugins>
</build>
</project>
控制檯:
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:demoMVC' did not find a matching property.
Mar 31, 2017 1:22:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 31, 2017 1:22:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 31, 2017 1:22:08 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1005 ms
Mar 31, 2017 1:22:08 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 31, 2017 1:22:08 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.34
Mar 31, 2017 1:22:12 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Mar 31, 2017 1:22:12 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 31, 2017 1:22:12 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 31, 2017 1:22:12 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3739 ms
它看起來不錯。那麼pom.xml呢?還有什麼是日誌?春天開始了嗎?調度員正在收到請求? –
嗨,我已經更新了這個問題。謝謝。 – trin
點擊鏈接時日誌怎麼樣? –