Hello World


<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<div id="hellomsg">here comes message.</div>

Java code:

package com.example;

import java.io.InputStream;

import org.mixer2.Mixer2Engine;
import org.mixer2.jaxb.xhtml.Div;
import org.mixer2.jaxb.xhtml.Html;

public class HelloWorld {

    public static void main(String[] args) throws Exception {
        InputStream is = HelloWorld.class.getClassLoader().getResourceAsStream("HelloWorld.html");
        Mixer2Engine m2e = new Mixer2Engine();
        Html html = m2e.loadHtmlTemplate(is);
        html.getById("hellomsg", Div.class).replaceInner("Hello World !");



<html xmlns="http://www.w3.org/1999/xhtml">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<div id="hellomsg">Hello World !</div>

Step by step Hello World on Maven/Eclipse project

1. create new project on eclipse

  • File -> New -> Other -> Maven -> Maven Project .
  • check the box of "Create a simple project (skip archetype selection)"
  • Input artifact information.
    • groupId: com.example
    • artifactId: myhelloworld
    • version: 0.0.1-SNAPSHOT
    • packaging: jar

2. edit pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


        <!-- 1.8 means Java8. change to 1.6(java6) or 1.7(java7) as you like. -->

            <version>1.3.1</version><!-- write latest version ! -->


3. update maven project.

right click project -> Maven -> Update Project

4. create hello world class under src/main/java

  • see the code above.

5. create template under src/main/resources

  • see the code above.

6. RUN !

Right click the HelloWorld.java and choose "Run as -> Java Application"