View Resolvers with Spring Boot: Difference between revisions
(→Pebble) |
|||
Line 88: | Line 88: | ||
=Pebble= | =Pebble= | ||
https://pebbletemplates.io/ | https://pebbletemplates.io/ | ||
<source lang="html"> | |||
<html> | |||
<head> | |||
<title>{% block title %}My Website{% endblock %}</title> | |||
</head> | |||
<body> | |||
<div id="content"> | |||
{% block content %}{% endblock %} | |||
</div> | |||
<div id="footer"> | |||
{% block footer %} | |||
Copyright 2018 | |||
{% endblock %} | |||
</div> | |||
</body> | |||
</html> | |||
</source> |
Latest revision as of 20:30, 23 September 2019
JSP
JavaServer Pages (JSP) is a technology that helps software developers create dynamically generated web pages based on HTML, XML, or other document types. Released in 1999 by Sun Microsystems,[1] JSP is similar to PHP and ASP, but it uses the Java programming language.
To deploy and run JavaServer Pages, a compatible web server with a servlet container, such as Apache Tomcat or Jetty, is required. <source lang="jsp"> <!DOCTYPE html> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <html lang="en"> <body>
Spring Boot JSP Example
Hello ${message}
Click on this <a href="next">link</a> to visit another page.
</body> </html> </source>
Thymeleaf
Allow Backend and Frontend developers to communicate throug text inside HTML repalaced at the template rendering with the text contained in the "text" attribute <source lang="html">
Welcome to our grocery store, Sebastian Pepper!
</source>
Apache FreeMarker
FreeMarker is a free Java-based template engine, originally focusing on dynamic web page generation with MVC software architecture. However, it is a general purpose template engine, with no dependency on servlets or HTTP or HTML, and is thus often used for generating source code, configuration files or e-mails. https://velocity.apache.org/
<source lang="html"> <#assign name = "${article.getName()}"> <#if name?starts_with("https")>
<a href="http://www.learn.com</a> <#else> <a href="http://www.vogella.com/tutorials/${name}/article.html">${title}</a>
</#if> </source>
Apache Velocity
https://velocity.apache.org/ <source lang="html"> <html>
<head> <title>Spring & Velocity</title> </head> <body>
#parse("/WEB-INF/fragments/header.vm")
$screen_content
#parse("/WEB-INF/fragments/footer.vm")
</body>
</html>
Index
Tutorials list
#foreach($tut in $tutorials) #endTutorial Id | Tutorial Title | Tutorial Description | Tutorial Author |
---|---|---|---|
$tut.tutId | $tut.title | $tut.description | $tut.author |
</source>
Pebble
https://pebbletemplates.io/ <source lang="html"> <html> <head> <title>{% block title %}My Website{% endblock %}</title> </head> <body>
{% block content %}{% endblock %}
</body> </html> </source>