Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Play 2.0 Template inclusion with "backed" logic
package controllers;
import play.api.templates.Html;
import models.MenuItem;
public class Menu {
public static Html render(String parent) {
List<MenuItem> menuItems = MenuItem.findByParent(parent);
// more business logic...
@(menuItems: List[MenuItem])
<h2>The Menu</h2>
@for(menuItem <- menuItems) {
<li><a href="@menuItem.url">@menuItem.title</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment