When rendering your views Scalate will look for a layout in the following folder:
/WEB-INF/layouts/default.ssp (or default.scaml but lets consider ssp).
So, create this file and add the following: (this snippet is taken from the book Scalatra in Action)
<%@ val body:String %>
<html>
<head>
<title>Scalatra CMS</title>
<!-- Bootstrap -->
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
<style type="text/css">
body {
padding-top: 60px;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<ul class="nav">
<li>
<a class="brand" href="/" id="server">
Scalatra CMS
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<%= unescape(body) %>
</div> <!-- /container -->
</body>
</html>
Then add an page, say bla.ssp
to /WEB-INF/templates/views/pages
.
The bla.ssp
will contain your html content, e.g.:
<div class="row">
<h2>everyone </h2>
<p class="lead">hello </p>
</div>
In the servlet add the following:
layoutTemplate("/WEB-INF/templates/views/pages/bla.ssp")
This should work.