Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Introduction to Apache Velocity

on

  • 2,406 views

Presentation for UK Java User Group Scotland

Presentation for UK Java User Group Scotland

Statistics

Views

Total Views
2,406
Views on SlideShare
2,406
Embed Views
0

Actions

Likes
1
Downloads
31
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Introduction to Apache Velocity Introduction to Apache Velocity Presentation Transcript

  • Apache Velocity Petteri Hietavirta [email_address] 27.10.2010
  • Velocity Engine
    • Been around since 2000, current v1.6.4
    • Can produce any text output
    • Processing - no compilation
    • Good separation of logic and presentation
    • Easier for devs and designers
  • Performance
    • Similar to JSP for dynamic pages
    • ... but much faster to develop on
  • Typical uses
    • Web frameworks
    • Code generation
    • Document & email generation
  • Context + Template
    • Templates are written in VTL - Velocity Template Language
    • Velocity context has the model and other objects required for the processing
  • VTL Syntax
    • # directives
    • line or block directives
    • built in syntax or macro declarations
    • $ references
    • variables, access to properties and methods
  • Simple example
  • Demo with Tomcat
    • Uses VelocityViewServlet
  • Extension points
    • Macros
    • Context objects included in the context
    • Custom resource loader
    • Custom directives
    • Event handlers
    • Introspectors
  • Velocity Tools
    • Collection of useful classes
    • GenericTools
      • DateTool, EscapeTool, SortTool ...
    • VelocityView
      • VelocityViewServlet, web specific tools ...
    • VelocityStruts
  • Security
    • Can you trust your template writers?
    • SecurityUberSpector
  • Velocity oddities
    • -1
    • swallow
    • macro output
    • static methods?
      • context.put("Math", Math.class);
    • enums, static fields
  • Use case: Content Control
    • More stuff in context
    • Velocity Tools are not used too much
    • Pushing MVC boundaries
    • Not too many Velocity related problems
    • www.contentcontrol.com
  • References
    • http://wiki.apache.org/velocity/HackingVelocity
    • http://stackoverflow.com/questions/159292/how-do-i-create-a-custom-directive-for-apache-velocity
    • http://wiki.apache.org/velocity/BuildingSecureWebApplications
    • http://wiki.apache.org/velocity/VelocityEditors
    • http://wiki.apache.org/velocity/PoweredByVelocity