1.文件上传方式的回顾
1.1 导入文件上传的jar包:
<!-- 导入文件上传所需要的jar包-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
1.2 上传方法
/**
* 文件上传
* @return
*/
@RequestMapping(value = "/tranditional",method = RequestMethod.POST)
public String fileUpload_tranditional(HttpServletRequest request) throws Exception {
System.out.println("fileUpload_tranditional");
/**
* 只有转发和POST才可以直接访问类路径下文件夹里的页面,
* 浏览器直接发GET请求只能访问类路径下的文件