blob: d1234ff97663895ae482167cb03ff7a55bb3493c [file] [log] [blame]
<HTML><HEAD><TITLE>Velocity Design</TITLE></HEAD><BODY alink="#023264" bgcolor="#ffffff" leftmargin="4" link="#023264" marginheight="4" marginwidth="4" text="#000000" topmargin="4" vlink="#023264"><TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD align="left" valign="top"><A href="http://jakarta.apache.org/index.html"><IMG border="0" hspace="0" src="resources/jakarta-logo.gif" vspace="0"></A></TD><TD align="left" bgcolor="#ffffff" valign="top" width="100%"><IMG align="right" alt="" border="0" hspace="0" src="resources/header.gif" vspace="0"></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" src="resources/void.gif" vspace="0" width="5"></TD></TR><TR><TD background="resources/line.gif" colspan="2" height="2" width="100%"><IMG alt="" border="0" height="2" hspace="0" src="resources/line.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD valign="top" width="1%"></TD><TD nowrap="1" valign="top" width="14%"><BR>
<P></P>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="index.html">Overview</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="getting-started.html">Getting Started</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="install.html">Install</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="design.html">Design</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="contributors.html">Contributors</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="code-standards.html">Coding Standards</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="license.html">License</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="todo.html">TODO</A></LI></FONT>
<P></P>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="user-guide.html">User's Guide</A></LI></FONT>
<FONT face="arial,helvetica,sanserif" size="-1"><LI><A href="developer-guide.html">Developer's Guide</A></LI></FONT>
</TD><TD align="left" valign="top" width="*"><TABLE border="0" cellpadding="3" cellspacing="0"><TR><TD><BR>
<DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" src="resources/void.gif" vspace="0" width="5"><B>Design</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" face="arial,helvetica,sanserif">
<P align="justify">
Velocity is a Java-based template engine. It can be used as a
standalone utility for generating source code, HTML, reports,
or it can be combined with other systems to provide template
services. Velocity will be tightly integrated with the
<A href="http://java.apache.org/turbine">Turbine</A>
web application framework. Velocity-Turbine
provide a template service by which web applications may be
developed according to a true MVC model.
</P>
<P align="justify">
Velocity has a myriad of potential uses -- generating SQL, PostScript,
or Java source code from templates -- but it is expected to be most
widely used by web developers looking for a viable alternative to
<A href="http://www.php.net/">PHP</A> and
<A href="http://java.sun.com/products/jsp/">Java
Server Pages</A> (JSPs).
</P>
<P align="justify">
Velocity allows web page designers to embed simple yet powerful script
elements in their web pages. These script elements work
in conjunction with a Context object, which is defined in Java code.
A context object--essentially a Hashtable that provides get and set
methods for retrieving and setting objects by name within the Context
--provides a &quot;hook&quot; from the Java code to the Velocity script
elements. These script elements allow a web designer to retrieve
objects from the Context and insert these into a web page as text
values. The web designer has some control over looping (for each)
and conditional statements (if/else).
</P>
<P align="justify">
Velocity enforces a Model-View-Controller (MVC) style of development
by separating Java code from HTML template code. Unlike JSPs,
Velocity does not allow Java code to be embedded in pages. Unlike PHP,
Velocity does not implement features with other functions. The MVC
approach is one of Velocity's great strengths, and allows for more
maintainable and better designed web pages.
</P>
<P align="justify">
Although MVC-style development can sometimes lead to longer incubation
periods for web sites, particularly if the developers involved are new
to MVC, this approach saves time over the long term (believe us, we have
been doing this for a long time now). The MVC abstraction prevents web page
designers from messing with a software engineer's Java code, and
programmers from unduly influencing the look of web sites. Velocity enforces
a contract that defines what roles people play in the web site development
process.
</P>
<P align="justify">
Velocity uses a grammar-based parser generated by
<A href="http://www.metamata.com/javacc/">JavaCC</A> (Java Compiler
Compiler) using the JJTree extension to create an Abstract Syntax Tree.
Its concept was borrowed from
<A href="http://www.webmacro.org/">WebMacro</A>. Those involved in
the Velocity project acknowledge and appreciate the development and design
work that went into the WebMacro project.
</P>
</FONT></TD></TR></TABLE></DIV><BR>
</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD bgcolor="#023264"><IMG height="1" src="resources/resources.gif" width="1"></TD></TR><TR><TD align="center"><FONT color="#023264" face="arial,helvetica,sanserif" size="-1"><I>
Copyright &copy; 2000 The Apache Software Foundation.
All Rights Reserved.
</I></FONT></TD></TR></TABLE></BODY></HTML>