1. Introduction
In this tutorial we will see what the vue.js framework is and how it works , and what its strengths and weaknesses are compared to other similar frameworks, su… Read More
Welcome readers, in this tutorial, we will implement the Freemarker configuration in a spring boot application. 1. Introduction Spring Boot is a module that provides rapid application develo… Read More
In this post, we’ll be looking up what does spring has to offer for developer experience.
Overview
Using IDEs like Eclipse, Spring Tool Suite, Intellij Idea a typical development setu… Read More
Freemarker is a Java-based template engine. In Freemarker, you can define a template in a text file. That template contains some place holders to populate the data, and some conditional… Read More
In this post, I am going to create 'user.ftl' file which has user template data and merge the template with fields from user object using Freemarker. Step 1: Create user.ftl file under… Read More
Interpolations are used to insert the value of an expression converted to text. Syntax${expression} Interpolation can be used in two places.a. Inside the text: Hello ${… Read More
Using ‘.’ Operator, we can access the nested objects. For example, a User instance has address details nested in it. We can map the user address in template below. stre… Read More
There are 3 basic building blocks in FreeMarker. InterpolationsInterpolations are represented by ${…}, FreeMarker will replace it with the actual value coming from the model obje… Read More
Using if directive, you can conditionally skip some section of the template. Syntax ... ...#if> For example, I would like to greet user with Mr. if user is Male and… Read More
FTL tags are used to call directives. For example, we can define id directive like below. Example ... ...#if> There are two kinds of FTL tags used to compose ‘… Read More
In Raw string literals ${, backslash do not have any specific meaning. How to define raw literal?Just put an r directly before the opening quotation mark or apostrophe-quote. Examp… Read More
An escape sequence is a sequence of characters that doesn't represent itself when used inside string literal or character. It is composed of two or more characters starting with backslash \… Read More
Using #else directive, we can specify what to do when the condition in #if directive is evaluated to false. Syntax ... ...#if> welcome.ftl Welcome Mr. ${user.name}… Read More
We can define multiple conditional checks using if-elseif-else directive. Syntax ... ... ...... ...#if> studentGrades.ftl You are failed You are passed… Read More
Using [], we can specify list elements directly in the template. listLiteral.ftlValue of element is : ${x}#list>Define ‘FreeMarkerUtil’ class that takes model class and t… Read More
Slicing is used to get the sub sequence. For example, for the sequence ["A", "B", "C", "D", "E", "F"].seq[1..*3] = ABseq[1..seq[1..*2] = BCseq[1..] = BCDEF Range ExpressionDescript… Read More
Using ‘+’ operator, you can concatenate lists or sequences. Example- ${userName}#list> Find the below working application. Step 1: Define listConcatenation.ftl… Read More
Items in the list are expression. So following snippet is completely valid. Value of element is : ${item}#list> Find the below working application. Step 1: Define ‘li… Read More
#sep directive is used to print something between the items of a sequence (not before the first item or after the last item). For example, countryNames.ftl${countryName}, #list>… Read More
‘include’ directive is used to insert the content of other file into the template. Syntax#include path>or#include path options>copyright.ftl… Read More
‘items’ directive is used if you want to print something before the first list item and something after the last list item. Syntax#list listOfItems>#items as item>li&g… Read More
?int built-in is used to get the integer part of the result of a division. Find the below working application. Step 1: Create intBuiltin.ftl file under src/main/resources/templates… Read More
Built-ins are just like methods in java. Freemarker provide lot of built-ins you can use while constructing the template files.https://freemarker.apache.org/docs/ref_builtins.html How t… Read More
Arithmetic operator is used to perform an arithmetic operation between operands. Following basic Arithmetic operators are supported in FreeMarker. a. Addition: +b. … Read More
A non-existent variable and a variable with null value is same for FreeMarker. By default, FreeMarker throws an error whenever it encounters a missing or null value. If you want to handle th… Read More
== : Test for Equality!= : Test for Inequality> : Greater than operator>= : Greater than or equal to operator NoteFreemarker can interpret >, >= are end of the tags. To prev… Read More
Using ?? operator, we can check whether variable exist or not. Syntaxunsafe_expr?? or (unsafe_expr)?? ?? return true if the variable exists and non-null. Example1 Welcome ${na… Read More
Assignment Operator (=) is used to assign some value to a variable. Example Find the below working application. Step 1: Define ‘assignmentOperator.ftl’ file under… Read More
In my previous post, I explained how to access nested properties using ’.’ notation, you can even use [] notation to access the value associated with the key. For example, b… Read More
We can define a map in template file by listing the key/value pairs separated by commas and put the list into curly brackets. Example{ "id" : 1, name": "krishna", "city": "Bangalore"}&n… Read More
Ranges are used to define sequences. Ranges can be defined by specifying what ranges of whole numbers it contains. Ranges are specified using .. operator. Example.2..5 gives [2, 3… Read More
You can access elements of list/sequence using index notation. Example primes[0] return the value at index 0 which is 2primes[1] return the value at index 1 which is 3 Find th… Read More
Using ‘+’ operator, you can concatenate maps or hashes. What if hashes contain the same key?The hash on the right-hand side of the + takes precedence. Example - Ca… Read More
Using ‘+’ operator, you can concatenate strings. Example Find the below working application. Step 1: Define stringConctenation.ftl file under src/main/resour… Read More
‘assign’ directive is used to define variables. Syntax Naming conventionsa. Variable name can only contain letters, digits, underline (_), dollar ($), at-si… Read More
You can access the individual character of a string using index notation. Example data[0] return the character at index 0 which is ‘H’.data[1] return the character at i… Read More
In this post, I am going to explain how to define custom directive by implementing TemplateDirectiveModel interface. Step 1: Create ‘LowerCaseFilterWriter’ that extends the… Read More
‘macro’ is used to define custom directives. Syntax ... ... ...#macro>‘name’: Name of Macro variable.param1, param2, ...: The name of the local varia… Read More
There are two ways to define custom directives in FreeMarker.a. Using macro directiveb. By implementing TemplateDirectiveModel interface.Previous &nb… Read More
‘StringTemplateLoader’ uses a Map with String-s as its source of templates. Follow the below step-by-step procedure to process a template using StringTemplateLoader. St… Read More
In this post, I am going to explain how to load template from a string and merge it with data model. Step 1: Define the template string.String userDetailsTemplate = "\n" + "name: ${user… Read More
Liferay Content Management Systems (CMS) has been around a long time and it is very popular as a CMS solution for numerous types of industries, businesses and functions. As with any good sof… Read More
Apache FreeMarker is a Java-based template engine focusing on the MVC software architecture. Although it’s mostly used for Servlet-based Web Application development, it can be… Read More
Java development services are a crucial aspect of modern software development, and choosing the proper Java framework is essential for building high-quality, scalable applications. As we loo… Read More
Apache FreeMarker is a free, open source, Java based template engine which allow you to create dynamic content by combining the static template with dynamic data. The template is… Read More
Posted on Sep 25 • Originally published at linkedin.com As promised, in this post I will walk you through an example of API integration with Sitec… Read More