当前位置: 代码迷 >> Java Web开发 >> springmvc的前后台联接
  详细解决方案

springmvc的前后台联接

热度:55   发布时间:2016-04-16 21:31:52.0
springmvc的前后台连接
我从别人的类里加的方法,,别人的方法能够执行,但是我的就报404,说
DEBUG - Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@1eb2004] in DispatcherServlet with name 'dispatcher'
DEBUG - No handler mapping found for [/userExamination/showCheckState],我在开头已经加上
/**
 * 查询审核状态列表
 * @param model
 * @param queryModel
 * @return
 */
@RequestMapping("showCheckState")
        public String showCheckState(Page page, Model model,BatchNoticePageModel queryModel,HttpServletRequest request),不知道怎么回事了。。。。。。
------解决思路----------------------
@RequestMapping("showCheckState")改成@RequestMapping("/showCheckState"),而且你请求的url是/userExamination/showCheckState,说明应该如下配置:

@Controller
@RequestMapping("userExamination")
public class A{
      @RequestMapping("/showCheckState")
      public String showCheckState(Page page, Model model,BatchNoticePageModel queryModel,HttpServletRequest request){
//TODO
}
}

这样的话,url就是/userExamination/showCheckState
------解决思路----------------------
今天上午我也碰到同样的问题,你贴一下你的jsp,再看下配置文件是否有改动
------解决思路----------------------
缺注解自动扫描吧,在dispatcherServlet-servlet.xml中加入
<context:component-scan base-package="showCheckState所在包" />
  相关解决方案