java spring framework view for Mustache.js templates
Switch branches/tags
Pull request Compare This branch is 3 commits ahead, 54 commits behind sps:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

mustache.js view for spring3

maven dependency


spring config

<bean id="viewResolver" class="org.springframework.web.servlet.view.mustache.MustacheViewResolver">
    <property name="cache" value="${TEMPLATE_CACHE_ENABLED}" />
    <!-- The default view path is below -->
    <property name="prefix" value="/WEB-INF/views/" />
    <!-- The default suffix path is below -->
    <property name="suffix" value=".mustache" />

layout and partials support

You can now use partials in your templates. The partials are either resolved through aliases that you supply as URI parameters in your view name or by explicitely putting view name as a partial. There are two reserved partial aliases called "inner" and "layout". Inner is the actual template view name (below its 'recruite/submit'). "layout" is the wrapping template. Partial aliases are also available in the model as a hashmap with the key 'partialAliases'.

Example Java:

@RequestMapping(value="/m", method = RequestMethod.POST)
public String mobilePost(Map<String, Object> model) {
	return "recruite/submit?layout=recruite/layout&header=recruite/header";


Hello World!
{{> recruite/explicit }}


{{> header}}
{{> inner}}