templating (templating) wrote in java_faq,
templating
templating
java_faq

What's the difference between passive and script-based templates?

The idea of script-based templates is to take a single model node and transform it to the desired output. As much template code plus much logic leeds to a hard to maintain monster people are looking for ways to reduce the logic code within the template.

Solution strategies on script based templating solutions

  1. Reducing language abilities
    Nowadays most template languages in java disallow arbitrary method calls. The idea is keep web developers from adding business logic to the template and thus reducing template size over all. However, there's some typical view or data binding logic, which in turn can't be realized within the template. As the model is the only way of communication with the template, this is typically solved by an additional model, where all the data has to be copied into.
  2. Provide a controlled way to embed (business) logic
    Like JSP Tags. Complex configuration and API are intended to prevent from getting to much tags.
  3. Complex template handling with inheritance
  4. Additional frameworks like Tiles or SiteMesh

Solving with passive templates

Passive templates in turn provide this view model by default. Data is simply copied into the view. There are solutions like Snippetory combining this with a strong abstraction layer. All logic is implemented in java. Editing, debugging, testing. All works fine with the tool one is used to.
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 1 comment