私の最初の春のmvcアプリケーションで404エラーが発生しました。すべての設定に続いて運がありません。あなたは問題を理解するのを手伝ってもらえますか?org.springframework.web.servlet.PageNotFoundを取得するnoHandlerFoundエラー
Following is the change:
のweb.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>HereWeGo</display-name>
<display-name>HereWeGo</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
ばねディスパッチャ-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">
<mvc:annotation-driven />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
HeyThere.java
サーバーコンソールで0Hello.jspの
<html>
<body>
<h1>First Spring MVC Application Demo</h1>
<h2>${welcomeMessage}</h2>
</body>
</html>
私は警告の下に取得しています:
org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/HereWeGo/] in DispatcherServlet with name 'spring-dispatcher'
私のプロジェクト名はHereWeGoです。
指定した注釈が削除され、「/ welcome」でアクセスされ、次のエラーで同じ応答が返されます。 ** org.springframework.web.servlet.PageNotFound noHandlerFound ** ** WARNING:名 '春-ディスパッチャ' でのDispatcherServletにURI [/ HereWeGoは/歓迎]でHTTPリクエストが見つかりませんマッピング** –
してくださいlocalhost:8080/com.aditya.spring/welcome 8080があなたのサーバポートである場合に歓迎してください。その場合は –
運がないことを教えてください。:も404ページを与えています。 –