0

在我的控制器的一种方法中PageController,我有

return redirect(routes.PageController.page_view("main", "home"));

这去/main/home。如何向其中添加 GET 变量,以便它应该例如转到类似的东西/main/home?redirect=0

4

1 回答 1

1

如果我理解你的问题,我也做了同样的事情:

public static Result GO_TO_OVERVIEW = redirect(routes.Bookmarks.index(0, "description", "asc", ""));

我的路线声明如下:

GET     /bookmarks  controllers.Bookmarks.index(p:Int ?= 0, s ?= "description", o ?= "asc", f ?= "")

我的索引函数:

public static Result index(int page, String sortBy, String order, String filter) {
    if (sortBy.isEmpty() || sortBy == null) {
        page = 0;
        sortBy = "description";
        order = "asc";
    }
    User user = User.getLoggedInUser(session("user"));
    Page<models.Bookmark> orderList = models.Bookmark.page(page, 20, sortBy, order, filter, user);
    return ok(views.html.bookmarks.list.render(orderList, sortBy, order, filter));
}

对你起作用吗?

于 2013-03-21T15:03:01.333 回答