SpringMVC接收不到前端传递的参数原因分析
前言 在学习SpringMvc的时候遇到了一个问题,后台一直接收不到前台传递过来的参数,耽误了好长时间终于找到了原因,写篇博客记录下这个坑,嘤嘤嘤 --__-- 代码清单 使用SpringMvc接受前台传递的参数非常简单,只要参数名和前台表单中的名称一致即可,我弄得是一个文件上传的例子,所以看下我的前台页面 <body> <!-- enctype="multipart/form-data"在文件上传时加入,编码类型,其值默认是application/x-www-form-urlencoded --> <form action="testFileUpload" method="post" enctype="multipart/form-data"> File: <input type="file" name="file" /> Desc: <input type="text" name="desc" /> <input type="submit" value="Submit" /> </form> <br><br> <a href="emps">List All Employees</a> </body> 下面是SpringMvc的控制器 @Controller public class springMVCTest { @RequestMapping("