zoukankan      html  css  js  c++  java
  • 校园商铺-4店铺注册功能模块-13前后端联调验证整体模块功能

    1.前端发起请求


    填入信息,31行添加断点,按F10

    2.服务端查看响应

    后端添加断点,F6执行,F5进入方法

    预期:店铺添加成功

    3.问题

    3.1服务端没有获取到传递的信息。

    如填入正确的验证码,服务端返回验证码不正确。断点查看结果为null。

    方法:
    1.导入依赖

            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.3.2</version>
            </dependency>
    

    2.sprint-web.xml添加文件上传解析器配置

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
        <!-- 配置SpringMVC -->
        <!-- 1.开启SpringMVC注解模式 自动识别controller类,不需要xml中做bean的配置-->
        <mvc:annotation-driven />
        <!-- 2.静态资源默认servlet配置
        	(1)加入对静态资源的处理:js,gif,png
        	(2)允许使用"/"做整体映射 -->
        <mvc:resources mapping="/resources/**" location="/resources/" />
        <mvc:default-servlet-handler />
        <!-- 3.定义视图解析器 -->
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
        	<property name="prefix" value="/WEB-INF/html/"></property>
        	<property name="suffix" value=".html"></property>
        </bean>
        <!-- 添加文件上传解析器 -->
        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" >
        	<property name="defaultEncoding" value="utf-8" />
        	<!-- 1024*1024*20 -->
        	<property name="maxUploadSize" value="20971520" />
        	<property name="maxInMemorySize" value="20971520" />
        </bean>
        <!-- 4.扫描web相关的bean -->
        <context:component-scan base-package="com.csj2018.o2o.web" />
    </beans>
    
  • 相关阅读:
    不用+做加法
    实用类型转换
    Failed to retrieve application JMX service URL
    0.辗转相除法
    1. 数组与字符串
    Java数据结构之257二叉树的所有路径
    Java数据结构与算法之DFS
    Java数据结构与算法之图
    Java数据结构与算法之快速排序、归并排序
    Java数据结构与算法之冒泡排序、选择排序
  • 原文地址:https://www.cnblogs.com/csj2018/p/12195525.html
Copyright © 2011-2022 走看看