SPRINGMVC error message for the request sent by the client is syntactically incorrect ()
Be sure to decide when data binding the parameter names in the controller method and the names of the parameters in the JSP page are consistent or in accordance with the binding specifications, if not consistent, may return the following error: The request sent by the client is syntactically incorrect (). The literal understanding is that the client sent a request syntax error. The reality is that SPRINGMVC cannot implement data binding.
Give an example to illustrate:
<sf:form method= "POST" commandname= "person" >
name:<sf:input path= "name"/><sf:errors path= " Name '/><br/>
pass:<sf:input path= ' pass '/><sf:errors path= ' pass '/><br age
: <sf:input path= "age"/><br/>
email:<sf:input path= "email"/><br/> The <input type=
" Submit "value=" Modify user "/>
</sf:form>
@RequestMapping (value= "/{name}/update", Method=requestmethod.post) public
string Update (@PathVariable String name1, person person, Bindingresult BR)
{
System.out.println ("...");
if (Br.haserrors ()) return
"/update";
Persons.put (Name1,person);
return "Redirect:/listpersoninfo";
}
The path in my form is name, and the controller Update method is name1.
And I made the mistake is: I submit the page in the form of the checksum, and in the Controller Update method before the Colonel to test the object without adding @validated, so will also report this error.
So controller should be modified as follows:
@RequestMapping (value= "/{name}/update", Method=requestmethod.post) public
string Update (@PathVariable String Name, @Validated person person, Bindingresult BR)
{
System.out.println ("...");
if (Br.haserrors ()) return
"/update";
Persons.put (Name1,person);
return "Redirect:/listpersoninfo";
}