This is one of the problems that I encountered in today's project, when I was very depressed, I did not find the reason for half a day. The last 1.1 points
Test submission data to slowly discover the clues, and finally to meet similar problems of friends a little advice!
My project is to use SPRINGMVC as the control layer, and then to add pages that the page needs to submit a bunch of data to the server when
When I finished writing the data submission, I didn't jump into the control layer as I thought, and jumped into the following page:
This let me tangled, never met before, the reason for this error is to say that the client submitted a request in the syntax error,
Thought for a long time, the last thought, may be the data into the background when the binding error, and then found that I submitted data there are two places
There may be a problem, one is the date type, one is the value entered by the checkbox, and the background corresponds to a string and a Boolean. Date type
In the data binding you need to write the type converter in the control layer, and then add the code in my Code:
@InitBinder public void Initbinder (Webdatabinder binder) { SimpleDateFormat DateFormat = new SimpleDateFormat ( "Yyyy-mm-dd"); Dateformat.setlenient (false); Binder.registercustomeditor (Date.class, New Customdateeditor (DateFormat, false)); }
SimpleDateFormat ("YYYY-MM-DD") the format passed in must be the format that the foreground passes over,
Then run, or error, the last discovery is a checkbox incoming problem, the checkbox value is changed to True, background Pojo
The property type is changed to a Boolean type and the last run succeeds.
Tip: This problem generally occurs, the description is very clear, because the request syntax, with the Get method to submit, to see if the URL parameter format is not correct. Do not modify it, or you need to convert it to write yourself a converter, such as the code block in. You can view data binding knowledge for SPRINGMVC.
Server, tomcat, webpage request error 400,the request sent by the client is syntactically incorrect problem