zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    jdbc(插入大对象及读取大对象、存储过程)
    jdbc批量插入操作(addBatch)
    javase(Properties集合及学生对象信息录入文本中案例)
    javase模拟斗地主洗牌和发牌(54)
    javase套接字编程
    javase网络编程
    javase多线程复制
    javase文件切割及融合
    设计原则
    模板方法模式
  • 原文地址:https://www.cnblogs.com/SysoCjs/p/9535207.html
Copyright © 2011-2022 走看看