spring mvc page not found no mapping found for http request with uri

我这里的报错实际情况是:

14:02:15,736 WARN  [PageNotFound] No mapping found for HTTP request with URI [/spring3MVC/abc/index.do] in DispatcherServlet with name 'spring3MVC'

其中,[spring3MVC/abc/index.do]是我请求的路径,就我现在的项目,我的请求路径是:

http://localhost:8080/spring3MVC/abc/index.do


spring3MVC是我的项目名,abc是action的注解用的,index是方法的注解

@Controller
@RequestMapping("/abc")
public class ZhujieRequestController  {

    protected final transient Log log = LogFactory.getLog(ZhujieRequestController.class);

    @RequestMapping("/index")
    public String index() {
        return "hello";
    }

}

其它的配置文件,比如web.xml和一些jdbc连接的我就不说了,就说核心xml文件:spring3MVC-servlet.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:tx="http://www.springframework.org/schema/tx"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans   
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd   
    http://www.springframework.org/schema/tx   
    http://www.springframework.org/schema/tx/spring-tx-3.1.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-3.1.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">




	<!--自动扫描的包名 -->
	<context:component-scan base-package="com.ideawu" />

	<!-- 默认的注解映射的支持 -->
	<!-- <mvc:annotation-driven /> -->

	<!-- 视图解释类 -->
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/" />
		<property name="suffix" value=".jsp" />
		<!--
			可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑
		-->
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
	</bean>

	
	

	<!-- 通过注解请求action里面的方法-->
	<bean id="annotationHandlerMapping"
		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
		<property name="order" value="0" />
		<property name="useDefaultSuffixPattern" value="false" /><!--请注意这里,value="false",就因为这个false,我从早上8点,弄到下午2点-->
		
	</bean>


	
	<bean
		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
</beans>	
基本配置就是这样,服务重启了好多变,总是不行,后来,我把
<property name="useDefaultSuffixPattern" value="false" />
的value改为true,就正常了。 哎,我也是刚学,碰到这个问题。   还好运气好,搞定了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值