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 :

400 Request error 
Due to the wrong grammar , The server could not understand the request . No modification , The client cannot repeat the request .
stay SpringMVC Medium Action Processing front desk ajax Please send it json Error converting data directly to corresponding entity class :
400 Bad Request, The backstage doesn't report any mistakes ,400 The request is invalid ( The request has a syntax problem or cannot satisfy the request ).

terms of settlement :

 Check the entity class for javabean Whether the type inside is the same as springmvc form Of form Whether the form names are consistent .
My error is caused by two associated entity classes form In the form name Name difference :
Employee.java 
 private Integer id;
private String lastName;
private String email;
private int gender;
private Department department; // The nonparametric construction method is omitted // Parametric construction method to omit //setter and getter Method to omit

Department.java

private Integer id;
private String departmentName; // The nonparametric construction method is omitted // Parametric construction method to omit //setter and getter Method to omit

form Forms :

<!--
Can pass modelAttribute Property specifies the bound model property ,
If the property is not specified , Default from request Read from a domain object command Form for bean,
If the attribute value does not exist , An error will occur
-->
<form:form action="emp-save" method="post" modelAttribute="employee">
<!-- path Properties corresponding to HTML The label of the form name attribute -->
LastName:<form:input path="lastName"/> <br>
Email:<form:input path="email"/> <br>
Gender:<form:radiobuttons path="gender" items="${genders}"/> <br>
Department:<form:select path="department" items="${dapartments}" itemLabel="departmentName" itemValue="id"></form:select><br>
<input type="submit" value="Submit">
</form:form>

hold path="department" Change it to path="department.id"

Here we are , My problem has been solved . Welcome to correct

SpringMVC form Form submission report 400 More related articles about mistakes

  1. js Record a form submission report with time 400 error

    When writing a function , There is no time in the form when it is submitted , The data will be sent to the background normally , Report as soon as you fill in the time 400 error , It's OK to see the background time , Look at the format returned by the front-end time control , But it just keeps reporting errors , I didn't find the submitted data printed out ...

  2. Java Beginner to master —— Wrong tune EasyUI+SpringMVC Form Submit the form to Contorller Chinese characters are garbled

    One . Error phenomenon . Interface Post Submitted to the Contorller At the time of Contorller There's a garbled code in it . Two . Problem solving . stay Web.xml Add the following code to solve . <filter> <fil ...

  3. springMVC form Forms submit multiple object collections -- Use ajax Submit -- The front desk json Format data encapsulation method

    (function ($) { $.fn.serializeJson = function () { var jsonData1 = {}; var serializeArray = this.ser ...

  4. SpringMVC( fourteen ):SpringMVC And form submission (post/put/delete Usage of );form Property settings encrypt=&#39;mutilpart/form-data&#39; when , How to correctly configure web.xml In order to put Submit form by

    SpringMVC And form submission (post/put/delete Usage of ) In order to cater to Restful style , The interface provided may contain :put.delete submission . stay springmvc In order to put.dele ...

  5. SpringMVC Use in bean To receive form Notes on the parameters of form submission

    This is what our predecessors have said about SpringMVC Receive form data and record the experience : SpringMVC Receive page form parameters springmvc Several methods to obtain request parameters Here's what I found when I used it , The predecessors did not record the details and points of attention ...

  6. About form Submit the form to Servlet when tomcat Solutions to startup errors

    1. Problems encountered In writing today jsp Code through form Submit the form to Servlet It came up when tomcat Startup error , I've been thinking about it for a long time , Finally a solution has been found . The key to solving the problem is xml Configured path and servlet Zhongmo ...

  7. c#WebApi Use form Form submission excel, Realize batch write to database

    Ideas : The user clicks the download template button , Get excel Templates , Then fill in the data and save it .from When submitting the form, select the saved one excel, Realize the batch import process of data First, put the template under the project directory of the server : Such as I usually put the template in :F ...

  8. Flask The return value of the base and form Form submission

    Catalog 1.Python At present, there are three main trends Web frame Django Tornado Flask contrast 2.Flask Installation 3.Flask The first simple application of 4.Flask Medium render_template ...

  9. Form There are several ways for forms to submit data

    One .submit Submit stay form Add... To the tag Action( Address of submission ) and method(post), And there's one submit Button (<input type='submit'>) You can submit the data , ...

Random recommendation

  1. Distinguish between browsers CSS hack( Include 360、 sogou 、opera)

    Although it is said to use css hack To solve page compatibility bug It's not a good way , But sometimes these hack It's still in use , For example, if you accept a second-hand or third hand legacy interface , Disorderly css Code , Compatible only in a browser bug, And they need ...

  2. Chuanzhi blog (JavaWeb All the knowledge about ) Lesson notes ( classic )

    One .       JavaWeb Basics The first day : 1.Eclipse Detailed explanation : (1).Bad versionnumber in .class file: Compiler version and run (JRE) Version does not match . high JRE edition ...

  3. NPOI Expand -- Determine whether the specified cell is a merged cell and output the row column span of the cell ( dimension )

    Because of the need to work across the merged cell to obtain data , So I wrote a NPOI The extension class . The main methods are as follows : 1. Determine the specified line / Column index ( Cell ) Whether to merge cells . 2. Gets the actual cell containing data for the specified column index . 3. Returns the specified line / It's a list of ...

  4. 【Mac】Mac OS X install GNU Command line tools

    macos Many of our users do it People involved , class unix The system brings many aspects , Especially often with linux People to deal with . But as a regular use linux The command line found out that macos Many of the command line tools in are bsd Tools , Follow lin ...

  5. Activiti( One ) activiti Database table description

    activiti Introduce : activiti It's a business process management (BPM) frame . It covers business process management . workflow . An open source in the field of service collaboration . agile . Extensible executable process language Framework . Developers can draw directly through plug-ins ...

  6. Luogu P2519 [HAOI2011]problem a

    Topic link \(Click\) \(Here\) \(DP\) Divine topic . We should learn one more in the future , Practice your IQ . The key point is to put " Yes \(a_i\) My personal score is higher than mine ,\(b_i\) My personal score is lower than mine " this sentence ...

  7. git-bisect last updated in 2.19.1【 turn 】

    from :https://git-scm.com/docs/git-bisect NAME git-bisect - Use binary search to find the commit that i ...

  8. mimkatz usage

    mimikatz usage privilege::debug    Get into debug Pattern sekurlsa::logonPasswords Check all user passwords sekurlsa::wdigest Read the current login with ...

  9. One a day linux command (16):tail command

    Copyright Notice Update :2017-05-20 Blogger :LuckyAlan contact :liuwenvip163@163.com Statement : Never forget the digger when drawing water , Reprint please indicate the source ! 1 The article introduces This paper introduces Linux Below mv command . 2. ...

  10. [Vue @Component] Write Vue Functional Components Inline

    Vue's functional components are small and flexible enough to be declared inside of .vue file next to ...