Spring reads the formData object, and the value of request.getParameter () is null.

jquery code, using the formData object

var formData = new FormData();
        //formData.append("shopImg", shopImg);
        //formData.append("shopStr", JSON.stringify(shop));
        var verifyCodeActual = $("-sharpj_captcha").val();
        if (!verifyCodeActual) {
            $.toast("");
            return;
        }
        formData.append("verifyCodeActual", verifyCodeActual);

        $.ajax({
            url : (isEdit ? editShopUrl : registerShopUrl),
            type : "POST",
            data : formData,
            contentType: "application/x-www-form-urlencoded",
            cache: false,
            processData: false,
            success : function(data) {
                if (data.success) {
                    console.log(data);
                    $.toast("");
                    $("-sharpcaptcha_img").click();
                } else {
                    $.toast("");
                    console.log(data);
                    $("-sharpcaptcha_img").click();
                }
            }
        });

after successfully post to the server, the Form Data read by chrome

spring key=verifyCodeActualnull

Mar.13,2021

method 1:

 $.ajax({
        url : url,
        type : 'POST',
        data : formData,
        processData: false,
        contentType: false,
        //contentType: "application/x-www-form-urlencoded",
        cache: false,
        processData: false,
        success : function(data) {
            if (data.success) {
                    console.log(data);
                    $.toast('');
                    $('-sharpcaptcha_img').click();
                } else {
                    $.toast('');
                    console.log(data);
                    $('-sharpcaptcha_img').click();
                }    
        }
    });
springmvc(MultipartHttpServletRequest request)
request.getParameter("verifyCodeActual");

method 2:

ajaxspringmvc(@RequestParam Map<String,Object> map)map

Don't use formData to save request data, just use an object to save it.

var data = {"verifyCodeActual":verifyCodeActual};

FormData is the request format needed to upload files

Menu