for example:
<input type="text" id="TEST" value="12345" />
$.ajax({
...
url : 'test',
data : { TEST:$("#TEST").val() },
...
})
public class User {
private String TEST;
public String getTEST(){ return TEST ;}
public void setTEST (String TEST) { this.TEST = TEST; }
}
@RequestMapping(value="test",method={RequestMethod.GET,RequestMethod.POST})
@ResponseBody
public String test(User user){
//deal with user and return some data
}
At this time, the submitted data is bound to User. Do I have to use lowercase field names in Spring MVC?
代言2017-06-12 09:29:21
The first letter of the variable name is lowercase. This is the basic specification of Java programming. The naming of Java Beans and so on strictly follows these specifications, so that the framework can be developed easily.