请问这个问题时因为找不到 Controller?
我把web.xml springmvc.xml controller.java 这些全给贴出来, 希望大家能够帮我看下, 谢谢了.
百度了半天找到的答案都解决不了, 希望有朋友能够 帮忙看下.
我也把整个project给打包放到: http://pan.baidu.com/s/1jIax6S2
如果贴的代码看不清楚下面回答的截图有详细的配置信息.
工程类目结构:
控制台错误图:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
characterEncoding
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
characterEncoding
/*
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:beans.xml
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc.xml
springmvc
*.do
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
springmvc.xml:
<?xml version="1.0" encoding="UTF-8"?>
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" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<mvc:annotation-driven />
<!-- 视图解析器:
功 能:解析出真正的物理视图
返回逻辑视图:success
视图解析器:前缀+逻辑视图+后缀===物理视图、
:/WEB-INF/jsps/success.jsp
-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsps/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
ItemsController.java:
package cn.augmentum.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/items")
public class ItemsController {
@RequestMapping(value="/test")
public String test(){
System.out.println("aaaaa");
return "success";
}
}
web.xml:
springmvc.xml:
spring的配置文件: bean.xml
controller方法:
11:14:54,190 WARN org.springframework.web.servlet.DispatcherServlet noHandlerFound:1080 ->
No mapping found for HTTP request with URI [/xxxx/xxx/xxxx/中中央办公厅印发] in DispatcherServlet with name '......
答案就在这里:No mapping found for HTTP request with URI
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?