It's a library that allows Java to manipulate DOM, exactly like Javascript, using object orientation and language typing Java. Render and validate your application with more security and performance
Security: All of its logic, as well as rendering and validation, can be performed inside the server, this way we hide code.
Performance: The client-server communication is done with JSON, with this we have fewer bytes passing, which can be accomplished with either ajax, iframe or websocket.
JavaScript frameworks: As the library allows interac with Dom, then it will have access to any framework created for Javascript, but to let the writing more close to Javascript, it will be necessary to create plug-ins, for example : jQuery, jQueryUI and Vue.js.
Min. Requirements
- Java 1.6
- Servlet 3.0
- Gson
- JSOUP
- HTMLCompressor (Optional)
Javascript Cross-Browser Lib Support
Small example of visitor counts.
index.html
<html>
<body>
Amount of people that had seen this page: <span id="count"></span>
</body>
</html>
IndexController.java
@Page(name="index", path="index.html")
public class IndexController extends Window {
private static int VISITORS_COUNT = 0;
public void init(JRenderContext arg0) {
document.getElementById("count").textContent((++VISITORS_COUNT)+"");
}
}
OR
Real time visitor count, so that a refresh page isnt necessary.
@Page(name="index", path="index.html")
public class IndexController extends Window {
private static int VISITORS_COUNT = 0;
private final Element spanCount = document.getElementById("count");
private int lastCount;
public void init(JRenderContext context) {
spanCount.textContent((++VISITORS_COUNT)+"");
this.lastCount = VISITORS_COUNT;
setInterval(new FunctionHandle("realTimeUpdate"), 1000);
}
public void realTimeUpdate() {
if(this.lastCount != VISITORS_COUNT) {
this.lastCount = VISITORS_COUNT;
spanCount.textContent(VISITORS_COUNT+"");
}
}
}
Understand:
- Annotation
More examples:
- Form
- Form With outside Button
- Form Validation
- Form With Data Manipulation
- Comet
- Internationalization
- Database Connection with MYSQL
- Database Connection with MYSQL/Hibernate
- Replace Content
- Redirect
- Call Custom Function
- Call Custom Function With Callback
- Template
- Join Header Files
- User Principal/Rules
- Java Script Module System