VelocityServlet is a subproject of Velocity. Its goals is to create a
standalone Velocity servlet that can be used for template rendering
in Web applications.
Intended audience of this subproject are Web
application developers that plan on adding Velocity as a view layer
technology to their Servlet-based web application framework. VelocityServlet
offers the following key features:
- VelocityViewServlet provides is a standalone Java servlet that renders Velocity
templates. Its class name is
org.apache.velocity.tools.view.servlet.VelocityViewServlet .
It can be invoked either directly from Web clients or from other servlets
by forwarding request for template rendering to it. Its usage is
similar to the JSPServlet for rendering JSP pages.
- VelocityViewServlet makes ServletRequest attributes, HttpSession attributes and
ServletContext attributes automatically available to the template designer
through the Velocity context. It is not necessary to explicitely
populate the Velocity context.
- VelocityViewServlet offers toolbox support. It is possible to define a set
of view tools (view helpers) that are made available to the template
designer automatically through the Velcity context.
- Velocity log output can be redirected to the log infrastructure
of the Web application. By default, the log is directed to the
logging facility provided by the Servlet API.
Using VelocityViewServlet, it becomes possible to write Web applications that are
independent of a particular view technology. This opens a straightforward
migration path between JSP pages and Velocity templates as the view layer
technology in Web applications.
A typical application case for VelocityViewServlet is to use it in conjunction
with a Servlet-based web application framework.
VelocityStruts is a Velocity
subproject that brings Velocity to the Struts world and is the first
application that takes advantage of VelocityViewServlet.
To be added
- Examples
- Configuration of Servlet
- Configuration of Toolbox
- Javadoc
|