After flexibility, I don't have to introduce Struts in the project, you can save a bit of server resources. In addition, if the JSP file is modified, the first runtime is modified, it will have a significant delay because it is necessary to recompile to CLASS. But modify the FTL template file of the FM, refresh the page almost no delay, because the FTL template does not need to be compiled. Maybe you will think, how is the efficiency of such a combination? But you look from another perspective, the efficiency of the ASP itself is not high, but it can also be active in the large server side, not to mention Java. I have said in the previous chapter. If you have used the Action written in Struts, you can replace the JSP file directly with the FTL template. The control layer of the MVC is completely embodied in the display layer. And if you do a good FTL template, you can also be universal in many places in the future. Where can I use? In the FM website, provide a netizen development template that allows users to easily convert documents to RTF format. For example, in a universal template RTF.FTL has the following macro: <# macro big> {/ fs # rtf_bigfontsize * 2} <#NESTED>} <# t> # macro>
<#macro h1> {/ fs # {rtf_h1fontsize * 2} <#NESTED>} <@ newline /> <# t> # macro>
Of course, there is a place to define the entire RTF file structure. Xiaozhen.
<#ssign = 10> <# assign rtf_bigfontsize = 12> <# assign rtf_smallfontsize = 8> <# assign rtf_h1fontsize = 18> <# assign ign_h2fontsize = 14>
<#ssign rtf_intable = false> <# assign = 1> <# macro document> {/ r m {d s c 1033 <# {/ fonttbl <#t> <# - fel free to change these FONTS (Except for F100) ... Just Make Sure You Keep The Same Charset IF You Want RTFStringModel To Keep Working! -> {/ f0 / fswiss / fcharset0 arial;} <# t> {/ f1 / fswiss / fcharset238 / FPRQ2 Arial Ce;} <# t> {/ f2 / fswiss / fcharset204 / fprq2 arial cyr;} <# t> {/ f3 / fswiss / fcharset161 / fprq2 arial gift;} <# t> {/ f4 / fbidi / froman / fcharset177 / fPRQ2 Times new Roman (Hebrew);} <# t> {/ f5 / fbidi / froman / fcharset178 / fPRQ2 Times new Roman (Arabic);} <# t> {/ f6 / fswiss / fcharset186 / fprq2 arial baltic } <# t> {/ f100 / fnil / fcharset2 symbol;} <# t>} <# t> / viewkind4 / uc1 / pard / f0 / fs # {rtf_defaultfontsize * 2} <# T> <#NESTED> < #T>} <# t> # macro> Note: Here <#T> is a wrapper
Then call <#import "RTF.FTL" as RTF> <@ rtf.document> <@ r1> my big header <@ r1> <# T> <@ rtf.big> BIG @ rtf.big> <# t> <@ rtf.big> $ {{@ rth.big> <# t> @ rtf.document>
Is it very convenient? You can go here to download: http://www.freemarker.org/libraries.html.