Is it possible in playframework to override the default save action in the CRUD controller and redirect to the list after

I use the Play framework to work with a large number of modules. The fact is that I would like to do special processing and verification before my object is saved. Therefore, I created a save action in my CRUD controller. So far, so good. But now, after saving the object, I would like to display a list of objects, as the CRUD module did before I redefined its save action. How can i do this?

Here is my controller:

package controllers.admin; import java.util.List; import models.Category; import controllers.CRUD; @CRUD.For(Category.class) public class Categories extends CRUD { public static void save(Long id, Category category) { // Do my custom save process here //Redirect to the list page like CRUD was doing before I created this save action } } 

I tried different things like parent() [Fatigue] is not what I wanted. I tried CRUD.list() , but I need to pass parameters that I don't have. I also tried render(admin/Categories/List.html, ??????); but I would have to pass the list and I don’t know what to call it.

Any help would be appreciated.

+2
source share
1 answer

You are on the right track. In the end, just call redirect(request.controller + ".list"); It should work.

+5
source

Source: https://habr.com/ru/post/1387033/


All Articles