Scenario: Programmers do not like to read the document, but prefer to copy the example. Therefore, we have made the components of the Platform group into examples for others to refer to. We use the front-end display layer is freemarker, so encountered this problem, such as we want to let the front-end display Freemarker own source code when there is a problem (because our example program's page is also used Freemarker). The following problems are encountered:
1, how to display the HTML source code, rather than let the browser parse the HTML, by using Freemarker HTML escape.
For example, we show the IMG tag, that is: ${' "html}, so that the final content on the page is: , and will not be parsed by the browser.
2, display Freemarker source code, such as ${} symbol, you can be as follows:
${R' ${obj.name} '}, so the final result is: ${obj.name}, not parsed by Freemarker. It is important to note that the "R" character in front of the red is the key point.
3, custom macro end symbol can not come out of the solution: for example, we have customized a macro called:< @cfw. column></@cfw. column> If you want to show the source, the end of the symbol "</@cfw .column> "Is not shown, this time can be used in the way of character escapes, such as:
${' </@cfw. Column '}, which shows the result: </@cfw .column>
Not what the technical content of things, write down to prevent forgetting, also by the way to help you solve some problems.
Freemarker output $ and special symbols such as HTML tags