Instant FreeMarker Starter

Book Description

Structure your enterprise-class projects with FreeMarker!

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results.
  • Build realistic enterprise projects on your own
  • Create your first template with FreeMarker
  • Learn how to integrate with the Struts2 and Spring frameworks

In Detail

Generating completed text documents by filling in blanks on a template is as old as printing, but this simple and straightforward approach to creating web pages and other computer-generated text using FreeMarker has only recently begun to gain popularity.

Instant FreeMarker Starter uses hands-on, real-world examples to show how to master its features, integrate with your web application framework, and effectively incorporate a template engine into your next enterprise project.

This guide gets you started quickly, showing you how you can begin using FreeMarker in less than a dozen lines of code. From there, it covers key features and shows you how FreeMarker integrates with popular MVC frameworks.

The core of the book walks you through the development of a program that generates a monthly newsletter from a complex data model. Along the way, you will learn strategies for organizing your FreeMarker logic in large enterprise projects. After covering the capabilities of FreeMarker, the book will show you how to integrate it with popular web application frameworks.

In short, the book will take your novice experience with FreeMarker to a level wherein you will create your own FreeMarker-based project.

Table of Contents

  1. Instant FreeMarker Starter
    1. Instant FreeMarker Starter
    2. Credits
    3. About the author
    4. About the reviewer
      1. Support files, eBooks, discount offers and more
      1. Why Subscribe?
      2. Free Access for Packt account holders
    7. 1. Instant FreeMarker Starter
      1. So, what is FreeMarker?
      2. Installing FreeMarker
        1. Step 1 – what do I need?
        2. Step 2 – downloading FreeMarker
        3. And that's it
      3. Quick start – creating your first template
        1. Step 1 – setting up your development directory
        2. Step 2 – writing your first template
        3. Step 3 – writing the Java code
        4. Step 4 – moving beyond strings
        5. Step 5 – formatting different types
        6. Step 6 – where do we go from here?
        7. Quick start versus slow start
      4. Top 9 features you need to know about
        1. Sample output
          1. Creating a model
          2. Running the template against the model
        2. FreeMarker expressions
          1. Objects and hashes
          2. Sequences
          3. Built-ins
          4. The default operator
        3. Directives
          1. Macros
          2. Functions
          3. Directive for conditional content
          4. Import
          5. The #switch directive
          6. The #list directive
          7. Using directives strategically
          8. Putting together a movie list
          9. #include and #setting
        4. Error handling
          1. #attempt and #recover
          2. Testing your template
        5. Review of newsletter project
          1. Design rule #1 – don't repeat yourself
          2. Design rule #2 – don't do too much in one file
          3. Design rule #3 – using test-driven design (TDD)
          4. Design rule #4 – decide on your own rules and follow them
        6. MVC integration
        7. Using the FreeMarker servlet
        8. JSP integration features
          1. Setting up
          2. Using FreeMarker tags in a JSP
          3. Integrating JSP tags into FreeMarker
          4. Invoking the JSP integration from a servlet
        9. Spring MVC integration
          1. Spring Portlet MVC
          2. Struts 2 integration
        10. What now?
      5. People and places you should get to know
        1. Official sites
        2. Tutorials
        3. Community

Product Information

  • Title: Instant FreeMarker Starter
  • Author(s): Charles Forsythe
  • Release date: April 2013
  • Publisher(s): Packt Publishing
  • ISBN: 9781782163824