Community contributed extensions

Scalate support

Scalate is a template engine written in scala. It supports two dialects: ssp (jsp for scala) and scaml (haml for scala). Play provides integration for both via a special Controller class.

Getting started

first you need to grab the release from the modules repository:

play install scalate-0.3

Starting a New Project

then if you start a new project all you need to do is:

play new myapp --with scala,scalate

(if you have any other version installed from scala or scalate than 0.3, then you will need to explicitly reference both ie. --with scalate-0.3,scala-0.3)

the scalate module is depending on the scala module, so both modules need to be installed and activated

Existing Projects

or if you want to configure an existing scala project, you will need to edit your conf/application.conf:


then set scalate’s dialect:




then you will also need to increase the heap size:


afterwards create a default layout file:

touch <yourapp>/app/views/default.<ssp or scaml> 

copy files related to 500 errors:

cp <scalate-module>/resources/500.scaml  <yourapp>/app/views/errors
cp <scalate-module>/resources/500.css <yourapp>/public/stylesheets

and finally you will need to change your controllers to inherit from play.mvc.ScalateController


object Application extends ScalateController  {
    def index(name: String = "Guest user") = render(name)  //populating context parameters via renderArgs("name",name) is also working

the corresponding template (ie view/Application/index.ssp) could look something like this:

<%@ var name: String %>
Hello ${name}

if the method above is invoked, play will render app/views/Application/index.ssp with the following context variables already populated:

and the following packages will be imported by default:

This means that you will need to have at least one class in each of these packages, otherwise templates can not be compiled

Intelligent error reporting

Compilation and syntax related issues are reported in the browser the usual way:

Precompile templates

play precompile

the command above will pregenerate all templates into the tmp folder

It’s worth noting that by default the precompiler is scanning only the first 20 lines of each template for variable declaration (ie <%@ var %> )

Difference between production and dev mode

in dev mode, play will alow instant template reloading, that is, if you make a change to a template and refresh the page, the change will apear. In production, however, template reloading is disabled for performance reasons.


scalate now supports layouts, partials as well. Play stores default layouts in app/views/default.ssp (or app/views/default.scaml).

Reverse URL

<%= url("Application.index") %>

this will give back the index page

<%= url("Application.something", Map("id"->5)) %>

this will resolve method “Application#something” with argument “id”

<%= absoluteurl("Application.index") %>

this will resolve the full url

<%= staticurl("/public/images/favicon.png") %>

this will resolve the full url for the favicon asset.


a sample application is bundled with the module and you can find it under samples-and-tests/simpleapp.