Maik Klein
Maik Klein

Reputation: 16158

Java Play 2 - Templating

I built my webapp from the sample "forms". Forms has a template called "main.scala.html" with the fixed navbar of twitter bootstrap. It's really easy to use , I just can include it in all my templates.

But now I have a small problem.

I want to render two differnt things in this navbar. A login button if the user has not signed in, and a logout button if he has singend in.

The annoying part would be that I would have to do this for all my templates.

edit:

Maybe I can read the session in the template?

Upvotes: 0

Views: 510

Answers (1)

ndeverge
ndeverge

Reputation: 21564

Yes, you can read the session from the template, but I suggest you to read this question and answer which may fit your need: How to avoid passing parameters everywhere in play2?

Upvotes: 2

Related Questions