一、Controller没有配置
page not found or method not supported.
没有扫描到包里面的controller类
<context:component-scan base-package="com.mk.controller" />
二、请求方式GET/POST
org.springframework.web.servlet.PageNotFound noHandlerFound
No mapping found for HTTP request with URI [/api/test/c] in DispatcherServlet with name 'dispatcher'
使用了RequestMethod.POST,Http的get请求无法响应
@RequestMapping(value = "/api/test/c",method = RequestMethod.POST)@ResponseBodypublic String bbx(){return "bb";}
三、Spring MVC中web.xml的url前缀
HTTP Status 405 - Request method 'GET' not supported
web.xml
<servlet-mapping><servlet-name>springMVC</servlet-name><url-pattern>/api/*</url-pattern></servlet-mapping>
四、参数基本类型数据为null值
@RequestMapping(value = "/test/a.do")@ResponseBodypublic String getA(int a){return "AA";}