All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.plugins.spincast-templating-addon.spincast-templating-addon.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
{% 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

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 %}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy