SpringMVC ajax background cannot get object properties

SpringMVC ajax background cannot get object properties

SpringMVC ajax background cannot get object properties

·

2 min read

recently encountered a problem, the record is as follows,

the situation with blog.csdn.net/loveme888/article/details/500.. is similar. I also encountered a problem when the struts2 project was replaced by springMVC. I referred to this blog, but the attributes of the objects in the background debug parameters are still null, so I can’t figure it out. I also encountered a problem when the struts2 project was replaced by springMVC. I referred to this blog, but the attributes of the objects in the background debug parameters are still null, so I can’t figure it out.

image.png The front endpoint is as follows:

image.png According to the tips of this blog, add stringify to the front desk, convert it into a json string, and mark the data type of the passed parameter in ajax

image.png Adding the @responsebody annotation in the background does not help

image.png In a flash, I found that there may be a problem with the value of the struts value stack. Since it is patient.xx, spring does not need to write in this way, it will automatically encapsulate the corresponding xx attribute to the corresponding object, so it is changed to

image.png Sure enough, I got the value in debugging. Although the problem is not big, it is easy to be negligent in modifying the framework, so I record it, and hope that people who encounter similar problems can refer to it~

Did you find this article valuable?

Support Kai Song by becoming a sponsor. Any amount is appreciated!