Server, tomcat, webpage request error 400,the request sent by the client is syntactically incorrect problem

Source: Internet
Author: User
Tags dateformat

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.