Use Java to write application logic; Use HTML5 to render the UI; {@link net.java.html.json.Model Animate an HTML page from Java}; Use {@link net.java.html.json.OnReceive REST} or WebSockets; interact with JavaScript; Get the best of both worlds! The goal of these APIs is to use full featured Java runtime (e.g. real HotSpot VM), but still rely on a very lightweight rendering technology (so it can potentially fit Bck2Brwsr and definitely to various types of phones). What can be more lightweight (from a browser perspective) than HTML!? By default we use {@link net.java.html.boot.fx JavaFX's WebView} component to display the HTML. We eliminate the need to manipulate the DOM directly, there is a special {@link net.java.html.json Java to Knockout.js binding}. As a result the HTML uses Knockout.js syntax, yet the application code can be written in Java.
Learn how to {@link net.java.html.json.Model animate an HTML page from Java} without referencing single HTML element from the Java code.
Use {@link net.java.html.json.OnReceive JSON} to communicate with REST based server API.
Use WebSockets and JSON.
Call JavaScript methods from Java and vice versa, via JavaScriptBody.
$ mvn archetype:generate \ -DarchetypeGroupId=org.apidesign.html \ -DarchetypeArtifactId=knockout4j-archetype \ -DarchetypeVersion=x.yAnswer few questions (for example choose myfirstbrwsrpage as artifactId) and then you can:
$ cd myfirstbrwsrpage $ mvn process-classes exec:javaIn a few seconds (or minutes if Maven decides to download the whole Internet of dependencies) you should see a sample Hello World application. It is basically composed from one Java and one HTML file:
$ ls src/main/java/**/DataModel.java $ ls src/main/webapp/pages/index.htmlPlay with them, modify them and enjoy Html for Java!