Why doesn't the background get anything when ajax sends json,?

<html>

<body>

    <input  id="customerId" >
    <input  id ="address" >
    <input     id="123" type="submit" >


</body>
<script src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$("-sharp123").click(function() {
  
    $.ajax({
        type: "POST",
        url: "http://10.2.163.2:7001/chatClientService/",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(GetJsonData()),
        dataType: "json",
        success: function (message) {
            
        },
        error: function (message) {
            
        }
    });
});

function GetJsonData() {
    var json = {
        "customerId": "7800071499",
        "address": "10.2.162.2"
       
    };
    return json;
}
</script>

</html>
@Controller(value = "blackServiceAction")
@Scope("prototype")
public class BlackServiceAction extends ActionSupport {
    private static final long serialVersionUID = -5155883818336614584L;
    @Autowired
    private BlackInfoDaoImpl blackInfoDao;
    public String execute() throws ServletException, IOException {
        HttpServletRequest request = ServletActionContext.getRequest();
        HttpServletResponse response = ServletActionContext.getResponse();
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        
        InputStream ins = request.getInputStream();
        
        InputStreamEntity entity = new InputStreamEntity(ins, 1024);
        String requestContent = EntityUtils.toString(entity, "utf-8");
        JSONObject requestJson = JSONObject.fromObject(requestContent);
        try {
            
            String customerId = requestJson.getString("customerId");
            String address = requestJson.getString("address");
            String result = isBlack(customerId,address);
            response.getWriter().print(result);
        } catch (Exception e) {
            System.out.println(e);
        }
        return null;
    }
May.23,2021

HTMLFormElement enctype

there is no application/json

at all.

Hello, the Form form does not have this attribute value. If you write this, you will still treat it as application/x-www-form-urlencoded and send it in the format username= Xiaohua & age=18 .

if you send JSON format, you can use AJAX, to set xhr.setRequestHeader ('Content-Type',' application/json'); , and then send it like this when you send:

xhr.send(JSON.stringify({
    username,
    password
}));

of course, you can also use jQuery, like this:

$.ajax({
    url:'user.php',
    type:'post',
    data:{
        user: '',
        age: 18
    }
});

give a default value?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33601-2be81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33601-2be81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?