【发布时间】:2014-11-26 05:50:24
【问题描述】:
你好,语法学家,
文档只显示:
flashing("success")
如果我使用play,就不会发生故障吗?我试过“failure”和“error”他们什么也没做
【问题讨论】:
标签: scala playframework playframework-2.0
你好,语法学家,
文档只显示:
flashing("success")
如果我使用play,就不会发生故障吗?我试过“failure”和“error”他们什么也没做
【问题讨论】:
标签: scala playframework playframework-2.0
您可以传入Flash 实例或Strings 的元组。它不必是特定的String。重要的是你处理你插入闪光灯范围的任何东西。
考虑这个例子(播放 2.3.4):
Application.scala
package controllers
import play.api.mvc._
object Application extends Controller {
def index = Action { implicit req =>
Redirect(routes.Application.flash()).flashing("something" -> "show this text")
}
def flash = Action { implicit req =>
Ok(views.html.index("Flash!"))
}
}
index.scala.html
@(title: String)(implicit flash: Flash)
<!DOCTYPE html>
<html>
<head>
<title>@title</title>
</head>
<body>
<h1>@flash.get("something")</h1>
</body>
</html>
路线
# Home page
GET / controllers.Application.index
GET /flash controllers.Application.flash
【讨论】: