-
POST请求-form表单
- 场景:表单提交,如果不用细分PUT/DELETE方法,则都可以用POST
- 注解:@PostMapping = @RequestMapping(method = RequestMethod.POST)
-
开发功能:账号密码提交登录接口,form表单形式
问题:提交数据参数特别多,难道要在方法上写很多参数么?
用一个对象去包装数据
一:用户实体类
/**
* 用户类
*/
public class User implements Serializable {
private int id;
private String username;
/**
* 定制化 针对密码不返回
*/
//@JsonIgnore
private String pwd;
public User(){}
public User(int id,String username,String pwd){
this.id=id;
this.username=username;
this.pwd=pwd;
}
public int getId() {
return id;
}
public void setId(int id) {