SpringMVC的@RequestMapping开发问题,404
蛋疼汇编 2015-12-01 03:41:26 在@controller加入@RequestMapping,运行时后台无报错,但页面会显示404错误,看看是哪的问题,代码如下:
@Controller
@RequestMapping("/Cabinet")
public class CabinetListController{
@Autowired
private CabinetService cabinetService;
@RequestMapping("/queryCabinet")
public ModelAndView queryCabinet() throws Exception {
// TODO Auto-generated method stub
List<CabinetHeadExtend> cabinetList =cabinetService.findCabinetHeadList(null);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("cabinetList",cabinetList );
modelAndView.setViewName("cabinet/cabinetList");
return modelAndView;
}
DEBUG时如下,访问controller正常,并且成功访问数据库,并且成功返回ModelAndView
DEBUG [http-bio-8080-exec-6] - ==> Preparing: SELECT cabinet_head.* FROM cabinet_head
DEBUG [http-bio-8080-exec-6] - ==> Parameters:
DEBUG [http-bio-8080-exec-6] - <== Total: 2
DEBUG [http-bio-8080-exec-6] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1ca905c]
DEBUG [http-bio-8080-exec-6] - Returning JDBC Connection to DataSource
DEBUG [http-bio-8080-exec-6] - Rendering view [org.springframework.web.servlet.view.JstlView: name 'cabinet/cabinetList'; URL [WEB-INF/jsp/cabinet/cabinetList.jsp]] in DispatcherServlet with name 'springmvc'
DEBUG [http-bio-8080-exec-6] - Added model object 'cabinetList' of type [java.util.ArrayList] to request in view with name 'cabinet/cabinetList'
DEBUG [http-bio-8080-exec-6] - Forwarding to resource [WEB-INF/jsp/cabinet/cabinetList.jsp] in InternalResourceView 'cabinet/cabinetList'
DEBUG [http-bio-8080-exec-6] - Successfully completed request
但是页面会报404的错误
HTTP Status 404 - /FaceRecognitionCabinet/Cabinet/WEB-INF/jsp/cabinet/cabinetList.jsp
type Status report
message /FaceRecognitionCabinet/Cabinet/WEB-INF/jsp/cabinet/cabinetList.jsp
description The requested resource is not available.
Apache Tomcat/7.0.56