Freemarker is a template engine and a text-based template output tool (generating arbitrary HTML form code ). It is a Java package and class library for Java programmers. It is not an end-user application, but allows programmers to embed it into their products.
Freemarker is designed to generate HTML web pages, especially MVC (Model View Controller)-based applications. The idea of using the MVC pattern as a dynamic web page is to separate page designers (HTML designers) and programmers .. Everyone makes what they are good. Designers can change the web page without modifying the programmer's code, because the application logic (Java program) and page design (freemarker template) are separated. Templates will not be damaged by complex and complex program frameworks. This separation is useful even when the programmer of a project and the creator of the himtl page are the same person, because it helps to keep the application clear and easy to maintain. Although freemarker has some programming capabilities, it is not a mature programming language like PHP. Different from Java, Java programs prepare data for display (such as SQL queries), while freemarker only generates a text page, which displays the preparation data for the template. Freemarker is not a web application framework, but is more suitable for serving as a component in the Web application framework. However, freemarker engine itself does not care about HTTP or Servlets, but only generates text. In a non-web application environment, it can also demonstrate its perfect use. However, it is worth noting that we provide a convenient solution for using freemarker. As a view component of the model2 framework (such as struts), you can also use JSP labels in the template. Freemarker is free and has BSD-style license. It is an open source software certified by OSI.
1. What is Servlet?
Servlet is a server program written in Java. It has nothing to do with the Protocol and platform. Servlet runs in Java-enabled web server. Java Servlet can dynamically expand server capabilities and provide Web Services in the request-response mode.
The earliest Java Web server that supports Servlet technology is javasoft. Later, some other Java-based Web servers began to support standard servlet APIs. The main function of servlet is to interactively browse and modify data to generate dynamic web content.