No mapping found for HTTP request with URI [/index.html] in DispatcherServlet with name 'springmvc'

原创 2016年05月30日 18:36:06

输入http://localhost:8080/index.html,后台一直报这个错:No mapping found for HTTP request with URI [/index.html] in DispatcherServlet with name 'springmvc'

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>javademo</display-name>
  
   <!--  Spring 服务层的配置文件 -->  
    <context-param>  
        <param-name>contextConfigLocation</param-name>  
       <param-value>classpath:applicationContext.xml</param-value>   
        <!-- <param-value>/WEB-INF/applicationContext*.xml</param-value> -->
    </context-param>  
      
    <!--  Spring 容器启动监听器 -->  
    <listener>  
        <listener-class>org.springframework.web.context.ContextLoaderListener  
        </listener-class>  
    </listener>  
  
    <servlet>  
        <servlet-name>springmvc</servlet-name>  
        <servlet-class>org.springframework.web.servlet.DispatcherServlet  
        </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/springmvc-servlet.xml</param-value>
        </init-param> 
        <load-on-startup>1</load-on-startup>  
    </servlet>  
    <!--为DispatcherServlet建立映射 -->  
    <servlet-mapping>  
        <servlet-name>springmvc</servlet-name>  
        <url-pattern>*.html</url-pattern> 
        <!--<url-pattern>/*</url-pattern>  --> 
    </servlet-mapping>  
  
  
  
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>
查了一下,这个配置文件是没有错的,原因是因为java文件中少了@controller注解;

package com.netease.web.controller;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class IndexController {
	
	@RequestMapping("index")
	public String xbsr(){
		return "index";	
	}

}





版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

警告: No mapping found for HTTP request with URI [/Springmvc/test] in DispatcherServlet with dispatche

拿SpringMvc练笔的时候,突然出现了这个问题,这个就是说明你的httpurl没有映射出来,也就是说的你controller没有注入。通常出现这种问题有2种情况,第一种 在springmvc-c...

springMVC中Dispatcher中的/和/*的区别

1. 首先 / 这个是表示默认的路径,及表示:当没有找到可以匹配的URL就用这个URL去匹配。 2. 在springmvc中可以配置多个DispatcherServlet,比如: 配置多个Dispat...

springMVC报WARNING: No mapping found for HTTP request with URI [/springMVC/hello] in DispatcherServle

在使用springMVC的时候报: WARNING: No mapping found for HTTP request with URI [/springMVC/hello] in Dispatc...

No mapping found for HTTP request with URI [/spring/WEB-INF/page/index.jsp] in DispatcherServlet with name &#39;spring&#39;

今天试了下spring mvc遇到个很奇怪的事情,按照书上配置访问时总是出现如下警告: org.springframework.web.servlet.DispatcherServlet noHan...

No mapping found for HTTP request with URI in DispatcherServlet with name 'XXX'

搭建框架的过程中遇到的一个错误: org.springframework.web.servlet.PageNotFound noHandlerFound 警告: No mapping found ...

Spring加载resource时classpath*:与classpath:的区别

Spring可以通过指定classpath*:与classpath:前缀加路径的方式从classpath加载文件,如bean的定义文件.classpath*:的出现是为了从多个jar文件中加载相同的文...

No mapping found for HTTP request with URI [/xxx] in DispatcherServlet with name 'despatcherServlet'

遇到这个问题总结一下: 1. springmvc的配置文件没有被加载,所以这里特别说明一下,如果您使用的是maven项目,并且在web.xml文件中配置的springmvc配置文件在classpath...

No mapping found for HTTP request with URI [/cwgl/department/index] in DispatcherServlet with name

No mapping found for HTTP request with URI [/cwgl/department/index] in DispatcherServlet with name '...

spring框架的项目报错:No mapping found for HTTP request with URI [ ] in DispatcherServlet with name 'spring'

SpringMVC框架的项目报错:No mapping found for HTTP request with URI [ ] in DispatcherServlet with name 'spri...

No mapping found for HTTP request with URI [/index.do] in DispatcherServlet with name 'SpringMVC‘

No mapping found for HTTP request with URI [/sys/index.do] in DispatcherServlet with name 'SpringMVC...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)