title: How can i fix this error? I use Java Spring MVC thymeleaf
body: <p>How can I fix it this error, I use java Spring-mvc thymeleaf, I want to move page from login page to tambah akun(sign up)page? but shows error</p>
  
  <p>this is my entity</p>
  
  <pre><code>@Entity
  @Table(name= "tb_akun")
  public class Akun {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;
  @Column(name = "username")
  private String username;
  @Column(name = "password")
  private String password;
  public Long getId() {
      return id;
  }
  public void setId(Long id) {
      this.id = id;
  }
  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;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is my Controller</p>
  
  <pre><code>@Controller
  @RequestMapping("/tambahakun/save")
  public class TambahAkunController {
  
  @Autowired
  private TambahAkunRepository tambahAkunRepository;
  
  @ModelAttribute("tambahakun")
  private Akun getTambahAkun(@RequestParam(value="id",required = false)Long id )
  {
      if(id==null)
          return new Akun();
      else
          return tambahAkunRepository.findById(id).orElse(null);
  }
  
  @RequestMapping(method = RequestMethod.GET)
  public String form() {
      return "tambahakun";
  }
  
  @RequestMapping(method = RequestMethod.POST)
  public String submit(@ModelAttribute("tambahakun") Akun tambahakun) {
  
      System.out.println(tambahakun.toString());
      tambahAkunRepository.save(tambahakun);
  
      return "redirect:/tambahakun";
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is My Html (tambahakun.html)</p>
  
  <pre><code>th:action="@{/tambahakun/save(id=${akun.id})}"method="post"th:object="${akun}"&gt;
  </code></pre>
  
  <p>This is my messages error</p>
  
  <blockquote>
    <p>2019-07-17 11:49:33.409 ERROR 14064 --- [nio-8080-exec-4]
    o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for
    servlet [dispatcherServlet] in context with path [] threw exception
    [Request processing failed; nested exception is
    org.thymeleaf.exceptions.TemplateProcessingException: Exception
    evaluating SpringEL expression: "akun.id" (template: "tambahakun" -
    line 12, col 43)] with root cause</p>
    
    <p>org.springframework.expression.spel.SpelEvaluationException: EL1007E:
    Property or field 'id' cannot be found on null</p>
  </blockquote>