[2.0] flashing not working on Results

56 views
Skip to first unread message

getagrip

unread,
Nov 26, 2011, 5:42:37 AM11/26/11
to play-framework
Flashing only works in case of doing a redirect:

### This works =>

Redirect(routes.Users.show).flashing("msg" -> "hello")

### This does not =>

Ok(html.user.show()).flashing("msg" -> "hello")

Both versions use the SAME template.

Message has been deleted

getagrip

unread,
Nov 26, 2011, 8:40:29 AM11/26/11
to play-framework
With "not working" I mean that the Flash-message is NOT shown:

def index = Action {implicit request =>
// flash is NOT shown:
// Ok(views.html.index()).flashing("msg" -> "this should work")

// flash IS shown:
// Redirect(routes.Application.thisworks).flashing("msg" -> "this
works")
}

def thisworks = Action {implicit request =>
Ok(views.html.index())
}

On Nov 26, 11:42 am, getagrip <getag...@web.de> wrote:

Message has been deleted
Message has been deleted
Message has been deleted

getagrip

unread,
Nov 26, 2011, 12:35:44 PM11/26/11
to play-framework
I just tested this with a newly created application. Also doesn't
work.

Xuefeng Wu

unread,
Nov 26, 2011, 12:58:32 PM11/26/11
to play-fr...@googlegroups.com
the scope of flash is the next request, not current.
If you want display message in current process, only what you do is pass a parameter value in the render method.
Reply all
Reply to author
Forward
0 new messages