Freemarker Type:
The supported types are:
Scalar: String, Number, Boolean, date
Containers: Hash tables, sequences, sets
Subroutines: Methods and functions, user-defined directives
Other: Node
Explain what the concept of a set in a container is: a set is a restricted sequence from the perspective of a template designer. You cannot get the size of the set, and you cannot take the sub-variables of the set through the index, but they can still be traversed by the list instruction.
Methods and functions: personal understanding and programming language is not very different, in terms of method, is the Freemarker code can invoke the method, for example, say:
There's a way to calculate the average, AVG (), and we can call AVG () directly to calculate the average of 3 and 5.
Separate suddenly, clear some ****************************** *************************************************************
User-defined directives: understood literally, that is, custom freemarker tags.
&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& & My goodness, my goodness, you can't guess. This is a row of split lines &&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &
The code for Freemarker programming is a template, also known as FTL, which has roughly three parts: text, interpolation, FTL tags
The knowledge of three parts is introduced in detail in the preliminary study of Freemarker.
The FTL programming has the following points to note:
1. FTL programming is case-sensitive
2. Interpolation can only be used in text
3. FTL tags can not be used in FTL tags and interpolation
4. Annotations can be placed between the FTL label and interpolation
5, the instruction nesting, basically and html,xml syntax similar, out the label starts with the #, the user custom instruction starts with @
6, when providing value to the interpolation, put it to the location of the output text to the value can be printed, such as ${(5+8)/2} will print out 6.5
7, < #if expression> expression must be a Boolean type, convex (艹 dish 艹) isn't that obvious?
Direct write true and false to characterize a Boolean value without the use of quotation marks
Sequence: Make a sequence of words, use commas to separate each of them, and then place the entire list in square brackets:
You can use Start...end to define a sequence that stores a range of numbers, such as 2. 5 and [2,3,4,5] are the same, that is, a few of them ... There are several numbers, the way the front is, the memory footprint is small and the speed is faster and more efficient.
Specifying a hash table in the template allows you to traverse a comma-separated "key/value" pair and place the list in curly braces. Keys and values appear paired and separated by colons. Like what:
{"Name": "Green Mouse", "Price": 150}
There are several ways to retrieve data from a hash table:
The hash table is as follows:
There are two ways to read the title:
1, through the Book.title
2, through book["title"]
The following examples are equivalent:
Book.author.name
book["Author"].name
Book.author. ["Name"]
book["Author" ["Name"]
Freemarker continue to study