Govind Singh
Govind Singh

Reputation: 15490

Sending Session in play framework template with java

How I am trying from controller:

 public static Result index() {
    session("connected", "[email protected]");
    System.out.println(session("connected"));
    return ok(views.html.index.render("testing"));
 }

And now I am trying to get session in html, how I am trying in views index.scala.html

@(message: String)(implicit session:play.api.mvc.Session)
@main(message) {
<div class="wrapper">
...

And I am getting:

error: method render in class index cannot be applied to given types;

Upvotes: 0

Views: 584

Answers (1)

edi
edi

Reputation: 3122

You don't need to declare the implicit session parameter within your template when working with Java. Just use @session.get("connected") within your template to retrieve the respective value from the session.

Upvotes: 2

Related Questions