Firstly, here's the site, and here's the code.  There's a slideshow, here.

Pragmatach is a Java-based web development platform that I wrote, based on ideas from Struts2Play, JSF2 and Grails.   My goals in writing it were:

  • Configuration via annotations.  I wanted to be able to fully configure a controller using only annotations and without having to write routes files, or XML
  • Simplicity.  I wanted to be able to quickly create a skeleton project with only a couple keystrokes
  • Modularity.  I wanted to be able to extend the framework quickly and easily
  • JSON and XML support. Client-side programmers prefer to communicate with servers via JSON and XML, so I wanted simple, easy JSON and XML support
  • Multiple Template Engines. I wanted to have support for multiple template engines.
  • Maven support.  I didn't want to use any other build system than maven.
  • Multiple container support.  I wanted to always produce a generic war file, and to have that war file run in any standard J2EE container.

Pragmatach supports these goals.  To create a Pragmatach program, simply use the Maven Archetype, here, at the command line.  This will create a fully functional Pragmatach application with:

  • A working pom.xml
  • A fully maven-compliant file system
  • Support for multiple containers, detailed here
  • The pragmatach Admin console
  • A single "hello world" Controller and Template.

The generated controller looks like this:

import java.util.Date;
import com.khubla.pragmatach.framework.annotation.Controller;
import com.khubla.pragmatach.framework.annotation.Route;
import com.khubla.pragmatach.framework.annotation.View;
import com.khubla.pragmatach.framework.api.PragmatachException;
import com.khubla.pragmatach.framework.api.Response;
import com.khubla.pragmatach.plugin.freemarker.FreemarkerController;
public class IndexController extends FreemarkerController {
 * the message
 private final String message = "Welcome to Pragmatach";
 public String getMessage() {
 return message;
 @Route(uri = "/")
 public Response render() throws PragmatachException {
 return super.render();
 public String getTime() {
 return new Date().toString();

A key aspect of the generated controller is the annotations.

  • The @Controller annotation tells Pragmatach that the class is a Controller.  By default controllers are session-scoped, but other scopes are available.
  • The @View annotation tells Pragmatach where to find the view template to render.  In this case "index.ftl", a FreeMarker template
  • The @Route annotation on the method "render" tells Pragmatach to bind the method "IndexController:render" to the HTTP context "/".  It's possible to bind routes to multiple methods on a class, which can be quite useful.   Additionally, via the @RouteParameter annotation, it's possible to bind parameters in the HTTP context path to Java method parameters.

In the case of the generated application, the view template is quite simple also.  It looks like this:

<!DOCTYPE html>
<h2>Current Time</h2>
<a href="${session.getServletContext().getContextPath()}/pragmatach/admin">Admin</a>

Since we have chosen FreeMarker as the template engine, we bind controller class methods using the ${} syntax.  The code "${controller.message} ends up binding the method "IndexController:getMessage".

There is a lot more to Pragmatach, including the Admin console, ORM support, and a small ecosystem of plugins.  The documentation is here.  If you'd like to see some working examples, they are here.

The pragmatach web site is here.  If you're interested in contributing, have a comment or need to ask a question, you can do that on Google Groups.  The documentation is here and the latest Javadoc is here.




Leave a Reply