# Putting a mustache on Tiles-3

DevFeed: [Putting a mustache on Tiles-3](<https://devfeed.tech/articles/putting-a-mustache-on-tiles-3-31963.md>)

Original publisher: [Read original article](<https://tech.finn.no2012/05/15/putting-a-mustache-on-tiles-3/>)

Author: mick

Published: 2012-05-15T18:58:12Z

Content type: tutorial

Language: en

Sources: [Finn.no](<https://devfeed.tech/sources/finn-no.md>)

Topics: [Framework](<https://devfeed.tech/topics/framework.md>), [Library](<https://devfeed.tech/topics/library.md>), [Code](<https://devfeed.tech/topics/code.md>), [Front end](<https://devfeed.tech/topics/frontend.md>)

Tags: [client](<https://devfeed.tech/tags/client.md>), [code](<https://devfeed.tech/tags/code.md>), [framework](<https://devfeed.tech/tags/framework.md>), [front-end](<https://devfeed.tech/tags/front-end.md>), [library](<https://devfeed.tech/tags/library.md>), [render](<https://devfeed.tech/tags/render.md>), [server](<https://devfeed.tech/tags/server.md>), [templates](<https://devfeed.tech/tags/templates.md>)

## AI overview

The article describes how FINN.no added Mustache template rendering to Tiles-3. It explains that the integration supports reusing templates on both the client and server, and shows configuration code for registering a Mustache renderer and replacing JSP attributes with Mustache templates.

## Source excerpt

We're proud to see a contribution from one of our developers end up in the Tiles-3 release! The front-end architecture of FINN.no is evolving to be a lot more advanced and a lot more work is being done by client-side scripts. In order to maintain first time rendering speeds and to prevent duplicating template-code we needed something which allowed us to reuse templates both client- and server-side. This is where mustache templates have come into play. We could've gone ahead and done a large template framework review, like others have done, but we instead opted to just solve the problem with the technology we already had. Morten Lied Johansen's contribution allows Tiles-3 to render mustache templates. Existing jsp templates can be rewritten into mustache without having to touch surrounding templates or code! The code please To get Tiles-3 to do this include the tiles-request-mustache library and configure your TilesContainerFactory like protected void registerAttributeRenderers(...) { MustacheRenderer mustacheRenderer = new MustacheRenderer(); mustacheRenderer.setAcceptPattern(Pattern.compile(".*.mustache")); rendererFactory.registerRenderer("mustache", mustacheRenderer); ... } protected Renderer createTemplateAttributeRenderer(...) { final ChainedDelegateRenderer chainedRenderer = new ChainedDelegateRenderer(); chainedRenderer.addAttributeRenderer(rendererFactory.getRenderer("mustache")); ... } then you're free to replace existing tiles attributes like <put-attribute name="my_template" value="/WEB-INF/my_template.jsp"></put-attribute> with stuff like <put-attribute name="my_template" value="/my_template.mustache"></put-attribute> Good stuff FINN!