spark-template-thymeleaf

Thymeleaf Template View Route implementation for Spark

Лицензия

Лицензия

Категории

Категории

Leaf Данные Базы данных
Группа

Группа

com.github.mwmahlberg.sparkjava
Идентификатор

Идентификатор

spark-template-thymeleaf
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

spark-template-thymeleaf
Thymeleaf Template View Route implementation for Spark
Ссылка на сайт

Ссылка на сайт

https://github.com/mwmahlberg/spark-template-thymeleaf
Система контроля версий

Система контроля версий

https://github.com/mwmahlberg/spark-template-thymeleaf

Скачать spark-template-thymeleaf

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.mwmahlberg.sparkjava/spark-template-thymeleaf/ -->
<dependency>
    <groupId>com.github.mwmahlberg.sparkjava</groupId>
    <artifactId>spark-template-thymeleaf</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mwmahlberg.sparkjava/spark-template-thymeleaf/
implementation 'com.github.mwmahlberg.sparkjava:spark-template-thymeleaf:0.0.1'
// https://jarcasting.com/artifacts/com.github.mwmahlberg.sparkjava/spark-template-thymeleaf/
implementation ("com.github.mwmahlberg.sparkjava:spark-template-thymeleaf:0.0.1")
'com.github.mwmahlberg.sparkjava:spark-template-thymeleaf:jar:0.0.1'
<dependency org="com.github.mwmahlberg.sparkjava" name="spark-template-thymeleaf" rev="0.0.1">
  <artifact name="spark-template-thymeleaf" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mwmahlberg.sparkjava', module='spark-template-thymeleaf', version='0.0.1')
)
libraryDependencies += "com.github.mwmahlberg.sparkjava" % "spark-template-thymeleaf" % "0.0.1"
[com.github.mwmahlberg.sparkjava/spark-template-thymeleaf "0.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.sparkjava : spark-core jar 2.0.0
org.thymeleaf : thymeleaf jar 2.1.3.RELEASE
nz.net.ultraq.thymeleaf : thymeleaf-layout-dialect jar 1.2.5

Модули Проекта

Данный проект не имеет модулей.

spark-template-thymeleaf

Build Status

Note: By default, spark-template-thymeleaf expects all templates to be under META-INF/templates, to be valid HTML5 (otherwise an exception is thrown during rendering) and have .html as the file suffix. So the path for the template in this example would be /META-INF/templates/testpage.html

How to use the Thymeleaf template route for Spark example:

package spark.template.thymeleaf.example;

import static spark.Spark.get;

import java.util.HashMap;
import java.util.Map;

import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.TemplateViewRoute;
import spark.template.thymeleaf.ThymeleafTemplateEngine;

public class ThymeleafExample {

	public static class Author {
		private String name;

		public Author(String name) {
			this.name = name;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
	}

	public static class TestViewRoute implements TemplateViewRoute {

		public ModelAndView handle(Request request, Response response) {
			Map<String, Object> model = new HashMap<String, Object>();
			model.put("title", "testpage");
			model.put("author", new Author(
					"Markus W Mahlberg <markus.mahlberg@icloud.com"));

			return new ModelAndView(model, "testpage");
		}

	};

	public static void main(String[] args) {
		get("/hello", new TestViewRoute(), new ThymeleafTemplateEngine());
	}

}

Версии библиотеки

Версия
0.0.1