|
Helping ordinary people create extraordinary websites! |
Client and server-side templating with VelocityBy Sing Li2004-06-13
Velocity vs. JSP technology on the server On the server side, you can use Velocity to process templates and generate dynamic content (HTML, XML, and so on). This is very similar in purpose to JSP technology. However, the JSP model provides unhindered access to the underlying Servlet API and Java programming language. In fact, to avoid access to these native features, you will have to exercise great discipline in coding (using only EL, tag libraries, and the like). Essentially, this is a wide-open access model. Contrast this with Velocity. Being a completely self-contained template engine and script interpreter, Velocity has a completely closed model. Access to anything specific to the system and/or the Java programming language must be explicitly enabled. By default, there is no access within a Velocity template to any facet of the Java programming language. This closed model allows Velocity to provide a decoupled templating presentation layer, cleanly separated from any application business logic or data management code. Let's now see server-side Velocity in action by integrating the templating engine to the latest Tomcat 5 release. Tutorial Pages: » Client and server-side templating with Velocity » Basic template engine operation » Velocity contexts » Velocity as a standalone parser » Velocity vs. JSP technology on the server » Deploying Velocity with Tomcat 5 » Interoperating with the Struts framework » Conclusions » Resources First published by IBM developerWorks |
|