templates.plugins.spincast-templating-addon.spincast-templating-addon.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
{% extends "../../layout.html" %}
{% block sectionClasses %}plugins hasBreadCrumb plugins-spincast-templating-addon{% endblock %}
{% block meta_title %}Plugins - Spincast Templating Addon{% endblock %}
{% block meta_description %}Spincast Templating Addon plugin{% endblock %}
{% block scripts %}
{% endblock %}
{% block body %}
Overview
This plugin provides an add-on
allowing Route Handlers
to easily access templating functionalities.
Make sure you read the section dedicated to the Templating Engine for more information.
Installation
If you use the spincast-default
artifact and the standard Bootstrapper,
this plugin is already installed by default so you have nothing to do!
If you start from scratch, using the spincast-core
artifact, you can use the
plugin by :
1.
Adding this Maven artifact to your project:
<dependency>
<groupId>org.spincast</groupId>
<artifactId>spincast-plugins-templating-addon</artifactId>
<version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>
2. Installing the provided SpincastTemplatingAddonPluginModule
module to your Guice context.
Plugin class
The class implementing the SpincastPlugin
interface is SpincastTemplatingAddonPlugin.
Suggested add-on
-
Name :
templating()
-
Component : TemplatingRequestContextAddon
-
Usage : to give your
Route Handlers
easy access to templating functionalities.
Example :
{% verbatim %}
public void myHandler(AppRequestContext context) {
Map<String, Object> params = new HashMap<String, Object>();
params.set("name", "Stromgol");
String html = context.templating().evaluate("<h1>Hi {{name}}!</h1>", params);
System.out.println(html); // <h1>Hi Stromgol!</h1>
}
{% endverbatim %}
This add-on is already installed by default on the
Request Context type.
Javadoc
{% endblock %}