After you asked and read more, it was called a βfeatureβ of Play! 1.2.4. Fortunately, we can expect more with v2.
In our particular application, there is a 3rd often neglected step when it comes to session variables. You need renderArgs for each of them to be available. Therefore, the comment from @ChrisJamesC was basically right: a step was skipped in the initialization.
Here's what happens in our Secure.scala controller:
(session("userid"), session("username"), session("name"), session("accounts")) match { case (Some(userid), Some(username), Some(name), Some(accounts)) => { renderArgs += "userid" -> userid renderArgs += "username" -> username renderArgs += "name" -> name renderArgs += "accounts" -> accounts Continue } case _ => { session += "path" -> Request.current().path Action(Authentication.login) } }
In my own case, I did not understand what I needed for renderArgs for each variable that I want to save and access in the session. But there is a trick: you still need to store each var as a string.
Then in each Play! view I can access var like this: @ctx("userid")
I hope this helps future people who use Play!
source share