Play 2.8 Session Issue

Im trying session creation in 2.8

is there any suitable documentation / GitHub example to do this
so far in 2.8 documentation I found withSession can be used

Java Code:
Map<String, String> myMap = new HashMap<String, String>();

	myMap.put("authResult", FAILED);

return ok(views.html.index.render(request,null, getList(), null, false, “”)).withSession(myMap);

POST /login controllers.Login.submit(req: Request)


@(request : Http.Request, caption: String, linkId: String, yearVisible: Boolean = false)(customContent: Html)
<form name="form1" method="post" action="@routes.Login.submit()" id="form1" >
<input id="authResult" type="hidden" value="@request.session().get("authResult")" />

When I checked in developer tool ,value of authResult is blank in very first request and request PLAY_SESSION cookie is blank adn response PLAY_SESSION cookie has JWT with value for authresult.

as Im fetching it from request.session in scala.html its blank and new subsequent request it shows value of authResult (and PLAY-SESSION JWT gets updated to request cookies.

Subsequent requests getting JWT hence UI is behind server response.

in play 2.8 documentation ,redirect has been used but not sure how to convert this return ok(views.html.index.render(request,null, getList(), null, false, “”)).withSession(myMap); to redirect call.

Thank you for the help

Usually, I use the session as:

return redirect(routes.HomeController.index()).
                addingToSession(request, "role", "ADMIN").
                addingToSession(request, "email", user.getEmail());

and I retrieve it using:

 @if(request.session().get("role").orElse(null) == "ADMIN") {


Thank you @morellik for your response.

I could do as per code snippet you have given,However I have index.scala.html which accepts below argument.

@(request : Http.Request , studentList: List[models.entity.Student] , studentCodesList: List[models.entity.StudentCode], fees: java.math.BigDecimal, submitResult: java.lang.Boolean, homePageMessage:String)

I wonder ,How can I achieve this using redirect and same time based upon conditional logic I need to prepare MAP of session + list of arguments which in return I would want to send to UI.