Knockout4Java

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Knockout for Java)
Line 9: Line 9:
-DarchetypeGroupId=org.apidesign.html \
-DarchetypeGroupId=org.apidesign.html \
-DarchetypeArtifactId=knockout4j-archetype \
-DarchetypeArtifactId=knockout4j-archetype \
-
-DarchetypeVersion=0.3
+
-DarchetypeVersion=0.7
</source>
</source>
Line 16: Line 16:
<source lang="bash">
<source lang="bash">
$ cd myfirstbrwsrpage
$ cd myfirstbrwsrpage
-
$ mvn process-classes bck2brwsr:brwsr
+
$ mvn process-classes exec:java
</source>
</source>
-
In a few seconds (or minutes if [[Maven]] decides to download the whole Internet of dependencies) you should see a sample [[Twitter]] demo application. It is basically composed from following three files:
+
In 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:
<source lang="bash">
<source lang="bash">
-
$ ls ./src/main/java/**/TwitterClient.java
+
$ ls src/main/java/**/DataModel.java
-
$ ls ./src/main/resources/**/index.html
+
$ ls src/main/webapp/pages/index.html
-
$ ls ./src/main/resources/**/twitterExample.css
+
</source>
</source>
-
Play with them, modify them. Of course, if you use any good IDE that speaks [[Maven]] (hint try [[NetBeans]] 7.3). Your development comfort even increases. For example you'll be able to debug your [[Java]] code.
+
Play with them, modify them. Of course, if you use any good IDE that speaks [[Maven]] (hint try [[NetBeans]] version 7.3 or higher). Your development comfort even increases. For example you'll be able to debug your [[Java]] code.
{{#ev:bliptv|6588275}}
{{#ev:bliptv|6588275}}

Revision as of 07:49, 14 January 2014

Knockout.js is powerful and attractive JavaScript library. It is lightweight and does its job (e.g. binding between a model and an HTML page) so well, that I decided to use it in my Bck2Brwsr and FXBrwsr projects and bind it together with JSON4Brwsr APIs.

Knockout for Java

Are you coming from a Java camp, yet interested in rendering via HTML? Well, then you are just three steps (in case you have Maven and JDK7 installed) away from reaching a nirvana. Just type:

$ mvn archetype:generate \
  -DarchetypeGroupId=org.apidesign.html \
  -DarchetypeArtifactId=knockout4j-archetype \
  -DarchetypeVersion=0.7

Answer few questions (for example choose myfirstbrwsrpage as artifactId) and then you can:

$ cd myfirstbrwsrpage
$ mvn process-classes exec:java

In 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.html

Play with them, modify them. Of course, if you use any good IDE that speaks Maven (hint try NetBeans version 7.3 or higher). Your development comfort even increases. For example you'll be able to debug your Java code.

Let me know what features you miss and what other you'd like to see in the FXBrwsr project.

<comments/>

Personal tools
buy