What is FreeMarker?

来源:百度文库 编辑:神马文学网 时间:2024/06/03 05:13:17
What is FreeMarker?
FreeMarkeris a "template engine"; a generic tool to generate text output(anything from HTML to autogenerated source code) based on templates.It‘s a Java package, a class library for Java programmers. It‘s not anapplication for end-users in itself, but something that programmers canembed into their products.
FreeMarker is designed to be practical for the generation of HTML Web pages, particularly by servlet-based applications following the MVC(Model View Controller) pattern. The idea behind using the MVC patternfor dynamic Web pages is that you separate the designers (HTML authors)from the programmers. Everybody works on what they are good at.Designers can change the appearance of a page without programmershaving to change or recompile code, because the application logic (Javaprograms) and page design (FreeMarker templates) are separated.Templates do not become polluted with complex program fragments. Thisseparation is useful even for projects where the programmer and theHMTL page author is the same person, since it helps to keep theapplication clear and easily maintainable.
Although FreeMarker has some programming capabilities, it is nota full-blown programming language like PHP. Instead, Java programsprepare the data to be displayed (like issue SQL queries), andFreeMarker just generates textual pages that display the prepared datausing templates.

FreeMarker is nota Web application framework. It is suitable as a component in a Webapplication framework, but the FreeMarker engine itself knows nothingabout HTTP or servlets. It simply generates text. As such, it isperfectly usable in non-web application environments as well. Note,however, that we provide out-of-the-box solutions for using FreeMarkeras the view component of Model 2 frameworks (e.g. Struts), which alsolet you use JSP taglibs in the templates.
 FreeMarker isFree, with BSD-style license. It isOSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1607835