1. For general Web development, most values are passed in JSON format.

For a JSP interface, through the interface to get the value of the text box after the form of Ajax to the back end of the value, such as {‘name’:’zhangsan’}, the background can be directly through the request to get the value.

For the value sent from the back end to the front end, the json format is also generally adopted. If multiple values are encapsulated as a List set, they are returned. List<Map<String,Object>>

String json = jsonArray.fromobject (list).toString();

Response returns the data to the interface: Response.getwriter ().print(json);

Once the interface takes the data, it needs to convert it to a JSON format that the interface can recognize, using a simple Ajax request as an example:

$.post( ‘servlet/Action’, 

{‘name’:’ booty ‘, ‘nickName’:’zexi’},

         function(data){

         var list =JSON.parse(data);

        for (var i = 0; i < list.length; i++) { 

}});

2. For transferring Chinese from the front end to the back end, garbled characters will be caused. In this case, the value to be transferred should be first converted into bytecode on the interface, then passed to the back end with bytecode of a specific encoding format, and then decoded according to the corresponding format:

Var name = $(“#id”).val();

If it is Ajax, the Chinese processing method is :encodeURI(name). If it is directly downloading related functions of the report, it is basically using window.location.href=” specific download address with parameters “. EncodeURI (encodeURI(name))

After being passed to the back end, it is decoded according to the corresponding encoding format:

name = URLEncoder.encode(name, “UTF-8”);

2.2 When the front-end obtains multiple data and transmits values to the back-end, the method of nesting objects in an array is generally adopted. For example:

      var arr = {}; 

      arr[‘tt1’] = tt1; 

      arr[‘tt2’] = tt2; 

      ‘arr’:JSON.stringify(map)

Back-end parsing mode:

        JSONArray arr = JSONArray.fromObject(params.get(“arr”)); 

        for (int i = 0; i <    arr.size(); i++) {

              JSONObject jsonMap = JSONObject.fromObject(arr.get(i));

              String tt1 = jsonMap.get(“tt1”).toString();

              String tt2 = jsonMap.get(“tt2”).toString(); 

              }