Skip to content
miguelperezcolom edited this page Sep 22, 2024 · 2 revisions

You have 2 ways to let a user create a new record from a crud: override the getNewRecordForm method or create an action by creating a method in the crud and annotating it with @Action. E.g. you can do something like this, in a class implementing the Crud interface:

 @Override
  public LanguageForm getNewRecordForm() {
    return context.getBean(LanguageForm.class);
  }

Later in the form you must return the crud if you want the user to return to the crud on saving:

  
  @MainAction
  public ProgrammingLanguages save() throws Throwable {
    repo.save(this);
    return applicationContext.getBean(ProgrammingLanguages.class);
  }
  
Clone this wiki locally