java - spring mvc, if the fields of the entity class are all capital letters, the data cannot be bound during the http request. Why?
仅有的幸福
仅有的幸福 2017-06-12 09:27:21
0
1
1021

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?

仅有的幸福
仅有的幸福

reply all(1)
代言

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template