當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Spring MVC请求url无效问题思考
生活随笔
收集整理的這篇文章主要介紹了
Spring MVC请求url无效问题思考
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一、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>?
四、參數(shù)基本類型數(shù)據(jù)為null值
@RequestMapping(value = "/test/a.do")@ResponseBodypublic String getA(int a){return "AA";}?
總結
以上是生活随笔為你收集整理的Spring MVC请求url无效问题思考的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 神笔马良故事 神笔马良故事介绍
- 下一篇: gradle idea java ssm