虚拟路径

SpringMVC学习 文件上传

点点圈 提交于 2019-12-05 07:44:13
依赖包: 头像上传: 上传表单: springMVC配置文件中添加 【多部分解析器】 <!--200*1024*1024即200M resolveLazily属性启用是为了推迟文件解析,以便捕获文件大小异常 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="209715200" /> <property name="defaultEncoding" value="UTF-8" /> <property name="resolveLazily" value="true" /> </bean> 页面源码: <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "