Playframework 2 - 在闪光灯上添加闪光灯 mvc.Result
Playframework 2 - Add flash on a flashed mvc.Result
有没有办法在不擦除以前的数据集的情况下向已设置的闪存范围添加新数据?
Redirect(routes.Application.home).flashing("success" -> "OK").flashing("but" -> "BUT")
结果相同:
Redirect(routes.Application.home).flashing("but" -> "BUT")
我可以 flashing("success"->"OK", "but"->"BUT")
但我将最后闪现的数据添加到另一个对象中。在一次调用中刷新数据需要重写很多东西...
也许是这样的:
Action { request =>
Redirect(routes.Application.home).flashing(request.flash + ("but"->"BUT"))
}
正如@cceneson 所建议的,我最终在 Map
中收集了闪烁的元素,然后使用 Redirect(routes.Application.home).flashing(myFlashMap)
将这些闪烁元素添加到结果中
有没有办法在不擦除以前的数据集的情况下向已设置的闪存范围添加新数据?
Redirect(routes.Application.home).flashing("success" -> "OK").flashing("but" -> "BUT")
结果相同:
Redirect(routes.Application.home).flashing("but" -> "BUT")
我可以 flashing("success"->"OK", "but"->"BUT")
但我将最后闪现的数据添加到另一个对象中。在一次调用中刷新数据需要重写很多东西...
也许是这样的:
Action { request =>
Redirect(routes.Application.home).flashing(request.flash + ("but"->"BUT"))
}
正如@cceneson 所建议的,我最终在 Map
中收集了闪烁的元素,然后使用 Redirect(routes.Application.home).flashing(myFlashMap)