1、通过注解ModelAttribute直接映射表单中的参数到POJO。在from中的action写提交的路径,在input的name写参数的名称。

package com.demo.model;

public class user {
    private String username;
    private String password;
    private  int nsex;


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public void setNsex(int nsex) {
        this.nsex = nsex;
    }

    public int getNsex() {return nsex;}
}
POJO

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-12-04
  • 2021-12-21
  • 2021-12-21
相关资源
相似解决方案