在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java/ 如何解決 No mapping found for HTTP ... name

如何解決 No mapping found for HTTP ... name 'mvc-dispatcher' ?

<?xml version="1.0" encoding="UTF-8"?>
<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:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    <!-- 配置SpringMVC -->
    <!-- 1.開啟SpringMVC注解模式 -->
    <!-- 簡化配置: 
        (1)自動注冊DefaultAnootationHandlerMapping,AnotationMethodHandlerAdapter 
        (2)提供一些列:數(shù)據(jù)綁定,數(shù)字和日期的format @NumberFormat, @DateTimeFormat, xml,json默認讀寫支持 
    -->
    <mvc:annotation-driven />


    <!-- 2.靜態(tài)資源默認servlet配置
        (1)加入對靜態(tài)資源的處理:js,gif,png
        (2)允許使用"/"做整體映射
    -->
    <mvc:default-servlet-handler/>
     
    <!-- 3.配置jsp 顯示ViewResolver -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
         <property name="suffix" value=".jsp" />
    </bean>
     
    <!-- 4.掃描web相關(guān)的bean -->
    <context:component-scan base-package="com.graduation.web" />

    <!--5.aop配置-->
    <aop:aspectj-autoproxy/>
</beans>

該配置的我都配置了,突然就請求不了了,控制臺總報這樣錯

No mapping found for HTTP request with URI [/graduation/seller/login] in DispatcherServlet with name 'mvc-dispatcher'

這是我的 web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    version="3.1" metadata-complete="true">
    <!-- 如果是用mvn命令生成的xml,需要修改servlet版本為3.1 -->
    <!-- 配置DispatcherServlet -->
    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <!-- 配置SpringMVC需要加載的配置文件
            spring-dao.xml,spring-service.xml,spring-web.xml
            Mybatis - > Spring -> SpringMVC
         -->
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/spring-*.xml</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <!-- 默認匹配所有的請求 -->
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- 統(tǒng)一編碼 -->
    <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

還有這是我的代碼
https://github.com/bananaLin/...

回答
編輯回答
氕氘氚

web.xml放出來

2017年2月5日 07:51
編輯回答
爆扎

我想你需要這個。

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>

這個配置是基礎(chǔ)。
Spring上下文加載監(jiān)聽器。WebApp在啟動的時候,需要這個來加載配置,形成完整的上下文環(huán)境。
上下文參數(shù)contextConfigLoaction不設(shè)置,則默認讀取/WEB-INF/applicationContext.xml這個文件。

參考:https://docs.spring.io/spring...

2017年4月16日 14:41
編輯回答
放開她

沒有找到處理/graduation/seller/login的Controller吧

2017年10月19日 09:00