Instant FreeMarker Starter [Instant]

This title is available as an eBook only
Instant FreeMarker Starter [Instant]
eBook: $14.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print & eBook also available on:
Learn in an Instant - Short, Fast, Focused
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
eBook : 64 pages
Release Date : April 2013
ISBN : 1782163824
ISBN 13 : 9781782163824
Author(s) : Charles Forsythe
Topics and Technologies : All Books, Instant, Web Development, Open Source

Table of Contents

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

Charles Forsythe

Charles Forsythe is a Systems Architect who works primarily in Java. Since graduating from the Massachusetts Institute of Technology in 1987, he has developed solutions for industries including Telecommunications, Health Care, Travel, Defense, and more. The projects ranged from embedded systems to global e-commerce systems. In the e-commerce sphere, Charles has used FreeMarker in several large projects. He currently lives in Saint Louis, Missouri.
Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sorry, there are currently no downloads available for this title.

Frequently bought together

Instant FreeMarker Starter [Instant] +    Scaling Apache Solr =
50% Off
the second eBook
Price for both: $30.45

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Load and process templates
  • How expressions access a data model
  • Create and use macros and functions
  • Control the formatting of different data types
  • Handle errors and missing data
  • Loop over repeating content
  • Control complexity by breaking templates into fragments and libraries
  • Regulate output with logical operations and conditionals
  • Use JUnit to test your templates
  • Integrate with frameworks such as Struts2 and Spring
  • Migrate from legacy JSP technology

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.


Get to grips with a new technology, understand what it is and what it can do for you, and then get to work with the most important features and tasks.A simple Starter approach introducing new concepts and terms through the hands-on building of templates for Java APIs.

Who this book is for

If you are a dynamic web developer or a Java-based apps developer new to FreeMarker, then this book will provide invaluable guidance to get your new project started on the right track. If you have started using FreeMarker and find it confusing or complicated, this book will be a guided tour that will show you how to conquer complexity and create a template-based view layer with an elegant architecture.

The book is also aimed at those who have elementary web development skills and basic Java programming knowledge. Readers should also have a conceptual understanding of the MVC model.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software