Playframework – Scala Template Common Tasks

1 Flares Twitter 0 Facebook 0 Google+ 1 LinkedIn 0 Filament.io 1 Flares ×

Compilation of  Common Tasks / Commands for Scala template –  Playframework

Here is a quick list of commands that can be used within scala templates in Play framework.

Iterate a List

Iterate a Map

For instance if you have a map with a string as key and a list as value, then you can use the syntax below to iterate

Preventing Html Escaping

By default all data you print in your scala templates are html escaped. Hence you cannot dynamically insert a java script using the @ notation because it will be escaped by the framework. In certain situations you may want to prevent the escaping of html content. This can be accomplished using the @Html tag.  Syntax @Html(variable)