when requesting:
case “page” :: AsInt(id) :: Nil => {
S.notice(“Hello world!”)
S.redirectTo(“/index”)
}
redirects to:
case “index” :: Nil => {
// replace the contents of the element with id “time” with the date
“#time *” #> DependencyFactory.inject[Date].map(_.toString)
}
however “Hello world!” doesn’t show up. It will show up on page if I comment the redirectTo.
Can anyone tell me why the session isn’t persisting past the redirect?
I suppose that’s because S.notice() places message in request scope and it’s not available after redirect (new request is created).
See following quotes from Exploring Lift book:
But:
So I think you can use following version of redirectTo method for this purpose:
def redirectTo [T] (where: String, func: () ⇒ Unit) : Tand make S.notice call inside registered function (second parameter).
Best Regards,
Vladimir