A jQuery-like HTML templating library written in Java
Latest commit 5c73045 Dec 15, 2012 2 @jawher Remove unrelated comment
Failed to load latest commit information.
.settings Initial commit Aug 13, 2010
src Remove unrelated comment Dec 15, 2012
.classpath Initial commit Aug 12, 2010
.gitignore Ignore idea files and dirs Sep 18, 2012
.project Initial commit Aug 12, 2010
.travis.yml travis-ci integration Nov 7, 2012
LICENSE Initial commit Aug 12, 2010
README.md travis-ci integration Nov 7, 2012
pom.xml master is now at 1.1.0 Nov 7, 2012



Build Status

A (relatively) tiny jQuery-like HTML templating library written in Java. In a nutshell, here's how to use moulder:

  1. parse a document
  2. select one or more elements (using jQuery's selectors syntax)
  3. apply one or more modifiers on the previous selection (add/remove/modify attribute, set text, repeat, ...)
  4. go back to 2 to alter as many other elements as needed
  5. profit !

Using this library

To use this library in your projects, just add the following to the dependencies section of your pom.xml (moulder is deployed in central):


I've compiled some simple and elementary use cases in this gist, and some more complex and advanced use cases in this gist.

Here's a quick sample of how moulder can be used to manipulate html:

Given this markup:

        <h1>dummy text to be replaced</h1>

This moulder based snippet:

Document doc = Jsoup.parse(HTML);
MoulderShop m = new MoulderShop();

List<String> items = Arrays.asList("summer", "autumn", "winter", "spring");

        attr("class", seq("even", "odd").cycle()),


Will generate the following:

        <h1 class="even">Spring</h1>
        <h1 class="odd">Summer</h1>
        <h1 class="even">Autumn</h1>
        <h1 class="odd">Winter</h1>

Or in plain english:

  • repeat the h1 element as many times as there are items in the list
  • For each generated h1 element, set it's class to even or odd
  • Also set it's text content to the corresponding season
  • And finally, append a paragraph after it


You need a Java 5 (or newer) environment and Maven 3 installed:

$ mvn --version
Apache Maven 3.0-beta-1 (r935667; 2010-04-19 19:00:39+0200)
Java version: 1.6.0_20
Java home: /usr/lib/jvm/java-6-sun-
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-22-generic" arch: "amd64" Family: "unix"

You should now be able to do a full build of ojaas:

$ git clone git://github.com/jawher/moulder-j.git
$ cd moulder-j
$ mvn clean install


Please consider using Github issues tracker to submit bug reports or feature requests.


See LICENSE for details.