我是新手。我有一个场景,比如我需要将收到的请求重定向到其他网址。
任何人都可以帮助提供可添加到 Controller 类中的 Play API 的示例代码片段吗?
最佳答案
要重定向到索引页面,请使用以下命令:
Redirect(routes.Application.index)
完整示例:
def foo() = Action {
// handle your post-request stuff here....
// Forward to index page (or somewhere else...)
Redirect(routes.Application.index)
}
关于scala - POST 请求 Play 2.3.x 后在 Play 中重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31161335/