iteye_12159
2012-02-27 17:06
浏览 307
已采纳

spring3.0.5MVC 获取不到@RequestMapping定义的Action类

在部署spring3.0.5 mvc时碰到获取不到自定义的actin类的问题,请帮忙看看,谢谢!

项目环境: spring3.0.5 release + hibernate3
配置文件web.xml:

dss
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
/META-INF/dss-servlet.xml

1


dss
*.do

dss-servlet.xml:


mvc:annotation-driven/

java代码:
@Controller
public class LoginAction extends BaseAction
{
UserDAO userService;

@RequestMapping(value = "/dss/login.do", method = RequestMethod.POST)
public String login(@RequestParam String name, @RequestParam String password, Model model,
        HttpServletRequest request) throws Exception
{}

}

运行tomcat,看到日志中已经匹配到了2012-02-27 15:46:20|INFO|Mapped URL path [/dss/login.do] onto handler 'loginAction'
但是在登录页面点击提交时找不到页面。日志中提示如下:
2012-02-27 15:47:24|DEBUG|opened session at timestamp: 13303288441
2012-02-27 15:47:24|DEBUG|DispatcherServlet with name 'dss' processing GET request for [/dss/login.do]
2012-02-27 15:47:24|WARN|No mapping found for HTTP request with URI [/dss/login.do] in DispatcherServlet with name 'dss'
2012-02-27 15:47:24|DEBUG|Successfully completed request

具体配置与日志见附件。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • jinnianshilongnian 2012-02-27 19:44
    已采纳

    @RequestMapping(value = "/dss/login.do", method = RequestMethod.POST)

    你只接受 POST请求

    而你请求的是GET
    2012-02-27 15:47:24|DEBUG|DispatcherServlet with name 'dss' processing GET request for [/dss/login.do]
    2012-02-27 15:47:24|WARN|No mapping found for HTTP request with URI [/dss/login.do] in DispatcherServlet with name 'dss'

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题