The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive re
使用SpringMVC,页面跳转时出现Bad Request:
信息如下:
Type Status Report
Message Required String parameter 'description' is not present
Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
提示信息Message那里提及到的‘description’,它是上传表单的其中一个参数,因为这个是第一个参数,所以只显示了description。使用springmvc上传文件功能时出现Bad Request,除了表单类型与@RequestParam POJO的属性类型不一致导致的原因外,还有一个可能性原因,就是没有配置MultipartResolver,因为springmvc默认情况下没有装配MultipartResolver,下面是配置MultipartResolver:
<!-- 配置上传文件 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>10485760</value>
</property>
<property name="defaultEncoding">
<value>UTF-8</value>
</property>
</bean>