Expected MultipartHttpServletRequest: is a MultipartResolver configured?

3 篇文章 0 订阅

上传文件1.首先form表单的结构是正确的 

    表单结构主要是
	<sf:form method="post" modelAttribute="user" enctype="multipart/form-data">
   		用户名称:<sf:input path="username"/><sf:errors path="username"/><br/>
   		用户密码: <sf:input path="password"/><sf:errors path="password"/><br/>
   		用户昵称: <sf:input path="nickname"/> <br/>
   		用户邮箱: <sf:input path="email"/><sf:errors path="email"/><br/>
   		附件:<input type="file" name="attach"/><br/>
   		 <input type="submit" value="添加用户"/>
   	</sf:form>
2.<span style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);">这里直接上传文件会报错:</span><br style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);" /><span style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; color: red; background-color: rgb(199, 237, 204);">Expected MultipartHttpServletRequest: is a MultipartResolver configured?</span><br style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);" /><br style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);" /><span style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);">因此我们需要在hello-servlet.xml中配置这个文件解析器</span><br style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);" /><br style="font-family: Simsun; font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);" /><pre name="code" class="xml" style="font-size: 14px; line-height: 26px; text-indent: 30px; background-color: rgb(199, 237, 204);"><bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
3.classpath问题:当spring.xml里面的http://。。。context.asd连接不存在的时候采用classpath:、org/spring。。。。。/
 

   

             

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值