No mapping found for HTTP request with URI.......

n009ww 发布于 2013/12/04 15:09
阅读 1K+
收藏 0

本人新搭建了个springMVC,web.xml中有如下配置


 <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/spring/spring-*.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/spring/*</url-pattern>
  </servlet-mapping>

在spring-mvc.xml中如下

<?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:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    <!-- 扫描controller的位置 -->
    <mvc:annotation-driven/>
    <context:component-scan base-package="com.n009ww.start.service.controller" />
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/pages" />
        <property name="suffix" value=".jsp" />
    </bean>

controller中的内容是

@Controller
@RequestMapping("/dailyList")
public class DailyListController {
    @Autowired
    ReportInfoService service;
    
    
    @RequestMapping(value = "/create")
    @ResponseBody
    public boolean createList(ReprotMessage message){
        boolean flag = service.createNewList(message);
        return flag;
    }
    @RequestMapping(value = "/getList")
    @ResponseBody
    public List<ReprotMessage> getList(int num){
        
        return service.getMlist(num);
    }
}
前台采用ajax请求,路径是“spring/dailyList/getList”,可是这个路径就是到不了后台啊。。。什么情况,求大牛解答

加载中
返回顶部
顶部