SpringMVC一直报404,访问不到请求的action,求各位大神帮帮忙看看

<?xml version="1.0" encoding="UTF-8"?>

SpringMVC2

index.html
index.htm
index.jsp
default.html
default.htm
default.jsp


SpringMVC
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
classpath*:config/SpringMVC-servlet.xml

1


SpringMVC
/


<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
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/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/> 

<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>   

<bean  name="/test1/multi" class="com.tag.web.controller.MultiController">
     <property name="methodNameResolver">
          <ref  bean="ParamMethodResolver"/>
     </property>
</bean>       

<bean id="ParamMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
    <property name="paramName"  value="action"></property>
</bean>


<bean id="viewResolver"   class="org.springframework.web.servlet.view.InternalResourceViewResolver">
     <property name="prefix" value="/"></property>
     <property name="suffix" value=".jsp"></property>
</bean>


```package com.tag.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

public class MultiController extends MultiActionController{

public  ModelAndView  Add(HttpServletRequest request,HttpServletResponse response){
    System.out.println("=====add======");
    return new ModelAndView("/multi","method","add");
}

public  ModelAndView  update(HttpServletRequest request,HttpServletResponse response){
    System.out.println("=====update======");
    return new ModelAndView("/multi","method","update");
}

}

访问的时候请求的是这个地址:http://localhost:8080/SpringMVC2/test1/multi?action=add




/test1/multi只映射到了MultiController,没有映射到方法啊!
建议用注解方式,配置文件方式不好用

配置文件,bean的路径写错了,把/取了。建议用@RequestMapping

试试:http://localhost:8080/test1/multi?action=add

用这个试试 http://blog.csdn.net/fengshizty/article/details/43086961

404是路径问题
一般是路径写错了
或是不存在,或访问方式不对导致不可访问
你检查检查相关路径的代码