[SpringBoot]Formの初期値を設定するサンプル

サンプルコード

@Getter
@Setter
public class UserForm {
  private String addr;
  private int score;
  private String username;

  UserForm(String addr, int score,String username) {
    this.addr = addr;
    this.score = score;
      this.username = username
  }

  UserForm() {
  }
  
  public void reset(Model model,HttpServletRequest request) {
    addr = "";
      score = 60;
      username = "";
  }
}

 

Spring Boot

Posted by arkgame