partially updated for version 2.5.0

News#

ztemplates#

ztemplates is a simple, easy to learn open source web framework based on Java jdk1.5 or later.

It is licensed under the Apache 2.0 License

It runs in any Servlet Spec 2.5 or later compliant web-container, like apache tomcat 6.

ztemplates supports Apache Velocity, JSP and FreeMarker out of the box and can easily be extended to your preferred rendering technology.

It integrates seamless with Spring.

ztemplates integrates into your maven projects.

Available on sourceforge and in maven central.

Features#

  • simple
  • statefree
  • Java centric
  • based on annotations and conventions
  • robust, refactoring-safe urls by two way action-to-url and url-to-action annotation based mapping
  • REST-ful urls: define variables in the url and map them to pojo properties
  • unobtrusive
    • no constraints on the url format
    • ztemplates is a filter that passes through urls it cannot match so you can transparently add it to or remove it from your existing webapp.
  • self-contained components. Components can be packaged into a jar and installed by dropping the jar into WEB-INF/lib
  • integrated JavaScript loading framework
  • CMS in the making

Monkey see - monkey do: Hello World#

All files in same location.

View layout#

Specify the view layout (preferred technology: Velocity=simple)

HelloWorldView.vm:


<html>
<body>
  <h1>Hello World!</h1>
  <div>
    $content
  </div>
</body>
</html>

View data#


/**
* data holder for view
*/
@ZRenderer(ZVelocityRenderer.class)
public class HelloWorldView {
  @ZExpose
  final String content;

  public HelloWorldView(String content) {
    this.content = content;
  }
}

Action#


@ZMatch(value="/helloworld", parameters={"message"})
public class HelloWorldAction {
  //parameter "message"
  String message;
  
  //do your work here
  public void after() throws Exception {
    HelloWorldView view = new HelloWorldView(message); 
    ZTemplates.getServletService().render(view);
  }
}

Next steps#

  • Read the Documentation
  • Take a look at the short examples and tutorials that show step by step how to create your first ztemplates application. You will touch the main concepts of ztemplates.
  • For latest developments go to the changelog

About the author#

ztemplates is written and maintained by Gerd Ziegler, a freelance Java Software pro from the Munich/Germany area.

If you need consulting or on-site training please follow this link to get my contact data.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-) was last changed on 22-Dez-2013 13:18 by gerdziegler.de