Although I am mainly studying. net, it is annoying that the hateful school is not forced to learn JSP.
When I was writing JSP today, I suddenly wanted to use the Ajax framework of MS with servlet to implement Ajax effect in JSP. There was a small problem in the middle:
In the servlet, the output using out. Print is a string. When you want to transmit multiple values, JSON is used. But how does the JSON string become an object after arriving at the room end?
After multiple experiments, the following methods are obtained:
VaR STR = "{ID: True, value: '1 '}";
VaR OBJ = eval ('+ STR + ')');
In this way, you can directly call: obj. ID obj. value.
On the contrary, if JSON is converted to string, you only need to use for to traverse the attributes and attribute values of the object and splice the strings. Time relationship. This function will not be written for the moment. Write it again. Hey.