Error code:
HTTP Status 400-
type Status Report
Message
Description The request sent by the client was syntactically incorrect.
Apache tomcat/7.0.47
Reason:
The server was unable to understand the request because of a malformed syntax. Without modification, the client program cannot repeat the request.
An error occurred while processing the JSON data from the foreground AJAX request to the corresponding entity class in the Action in SPRINGMVC:
The bad request, the background is not an error, 400 refers to the requests are invalid (the request has a syntax problem or can not meet the request).
Workaround:
Checks whether the type inside the JavaBean of the entity class is consistent with the Springmvc form's form table sole name.
My error is due to the fact that two associated entity classes cause the name names in the form form to be inconsistent:
Employee.java
Private Integer ID; Private String lastName; Private String email; Private int gender; Private Department Department; // Non-parametric construction method to omit // a method of constructing a parameter to omit // Setter and Getter methods to omit
Department.java
Private Integer ID; Private String departmentname; // Non-parametric construction method to omit // a method of constructing a parameter to omit // Setter and Getter methods to omit
Form form:
<!--The model property of the binding can be specified through the Modelattribute property, and if the property is not specified, the command's form Bean is read from the request domain object by default, and if the property value does not exist, the Birth Error - <Form:formAction= "Emp-save"Method= "POST"Modelattribute= "Employee"> <!--the Path property corresponds to the Name property of the HTML form label -LastName:<Form:inputPath= "LastName"/> <BR>Email:<Form:inputPath= "Email"/> <BR>Gender:<form:radiobuttonsPath= "Gender"Items= "${genders}"/> <BR>Department:<Form:selectPath= "department"Items= "${dapartments}"Itemlabel= "Departmentname"Itemvalue= "id"></Form:select><BR> <inputtype= "Submit"value= "Submit"> </Form:form>
Change path= "department" to Path= "Department.id "
By this point, my problem has been solved. You are welcome to correct me
Springmvc Form form submission 400 error