SpringMVC出现no mapping found for http request的解决办法
来源:互联网 发布:mac如何下载视频 编辑:程序博客网 时间:2024/05/23 00:06
SpringMVC出现no mapping found for http request的解决办法
错误一:
检查web.xml中的<servlet-mapping></servlet-mapping>
的<url-pattern></url-pattern>
将 <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> 改为: <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
错误二:
检查springmvc的配置文件(这里我的文件名为springmvc.xml):
这里有两点需要注意:
- 必须开启注解
<mvc:annotation-driven />
<context:component-scan base-package="com.xrda.controller"></context:component-scan>
中的base-package需要是包级别的。 下边是我的项目中的包
错误三:
还有一个确定的因素在这里也贴出来吧,如果以上两种方法都不行的话可以试试:
在springmvc配置文件中配置
<mvc:default-servlet-handler/>
跟错误二是同一个文件
错误四:
这个错误是比较好发现的,就是映射的地址写错了,比如:
@Controller@RequestMapping(value = "/test")public class FileUploadController { @RequestMapping(value = "/upload.htm" , method = RequestMethod.POST) public String upload(MultipartFile uploadFile,HttpSession session) throws IllegalStateException, IOException{ String fileName = uploadFile.getOriginalFilename(); String filePath = session.getServletContext().getRealPath("upload"); File file = new File(filePath, fileName); uploadFile.transferTo(file); System.out.println(filePath); return "message"; }} 我们访问的时候的地址应该是http://localhost:8080/项目名/test/upload.htm
菜鸟一枚,大神勿喷。
阅读全文
0 0
- SpringMVC出现no mapping found for http request的解决办法
- springmvc 出现No mapping found for HTTP request with URI
- springmvc出现:No mapping found for HTTP
- Springmvc 请求转发 No mapping found for HTTP request
- mark springmvc [No mapping found for HTTP request with URI]
- springMVC No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- springMVC--关于no mapping found for http request with uri
- springMVC--关于no mapping found for http request with uri .......
- springMVC No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI 解决办法
- SSM-----springMVC No mapping found for HTTP request with URI的问题
- 不一样的No mapping found for HTTP request with URI
- 深恶痛绝的No mapping found for HTTP request with URI
- springMVC报WARNING: No mapping found for HTTP request with URI [/springMVC/hello] in DispatcherServle
- 队列简单实现
- Docker 集群环境实现的新方式
- 爬虫技术(01)神箭手爬虫初学案例解读
- IFE-TASK10(任务十:Flexbox 布局练习)
- Tomcat下ajax请求路径总结
- SpringMVC出现no mapping found for http request的解决办法
- Adding libtool Support
- Codeforces 872C Maximum splitting【思维】
- “在工作中,与上级意见不一致”面试者如何巧妙回答?
- 水仙花数算法
- wpf 后台修改样式
- visio二次开发——事件编程
- libtool version mismatch error
- ArcEngine 地图图片输出 栅格不清晰