我试图找出如何使用Scala在Play(2.0)中的控制器操作中进行重定向.
重定向使用
Redirect(routes.Application.index)
Run Code Online (Sandbox Code Playgroud)
工作得很好.
我无法从文档,API或Google中找到的是如何在调用中添加参数.
我来自Grails,这可以很容易地完成如下:
重定向动作:"index",params:["key":"value"].
我找到的唯一方法是使用字符串url和查询字符串调用Redirect,这看起来很尴尬.
基本上我想以某种方式使用Redirect(Call),但我不知道如何使用反向路由创建Call对象.
我错过了什么/没有在Play/Scala中获得概念?
提前致谢!
在Groovy中有没有办法找出被调用方法的名称?
def myMethod() {
println "This method is called method " + methodName
}
Run Code Online (Sandbox Code Playgroud)
这与鸭子打字相结合将允许非常简洁(并且可能难以阅读)的代码.