Wait! I'm controlling the DOM from JAVA without React or Vue?! 🤯
WebForms Core 2.1 brings the latest version of WebForms.java to Java developers.
With WebForms Core (WFC), Java is no longer limited to generating HTML on the server and sending complete pages back to the browser. You can define browser events, receive requests, and send instructions that directly manipulate the existing DOM.
No React.
No Vue.
No application-level JavaScript required for DOM updates.
The browser runs WebFormsJS, while your Java application uses WebForms.java to generate instructions for the client.
This creates a simple but powerful model:
Browser Event
↓
Java / Spring Boot
↓
WebForms.java
↓
WebFormsJS
↓
DOM Update
The result is an interactive web application where much of the UI behavior can be controlled directly from Java.
WebForms Core is a product of Elanat, and its WebForms class is written in C#, and WebForms.Java is built on top of this class. Elanat plans to release the WebForms Core technology for all popular programming languages on the web.
form.exportToHtmlComment() vs form.response()
WebForms Core provides two important ways to export WebForms instructions.
form.exportToHtmlComment()
Use this when rendering the initial HTML page.
For example:
model.addAttribute(
"WebForms",
form.exportToHtmlComment()
);
And in a Thymeleaf page:
th:utext="${WebForms}">
The WebForms instructions are embedded into the generated HTML as HTML comments. When WebFormsJS processes the page, it reads those instructions and configures the required browser-side behavior.
For example, Java can register a click event:
form.setPutEvent(
"btn_Refresh",
HtmlEvent.ON_CLICK,
"/dashboard/refresh"
);
form.response()
Use this when responding to a WebForms request.
return ResponseEntity.ok(form.response());
This sends WebForms instructions back to the browser so WebFormsJS can immediately update the existing DOM.
For example:
form.increase("OnlineUsers", random.nextInt(80));
form.increase("Orders", random.nextInt(60));
form.increase("Revenue|", random.nextInt(9000));
form.setText("LastUpdate", "Just now");
Instead of rendering the entire page again, WebForms Core can update only what needs to change.
This is one of the ideas that makes WebForms Core particularly interesting: the server can send DOM operations instead of requiring you to manually write frontend DOM manipulation code.
A Java Dashboard Example
Imagine a simple dashboard.
The page contains statistics for online users, orders, revenue, and the last update time.
xmlns:th="http://www.thymeleaf.org">
charset="UTF-8">
WebForms Core Dashboard
...
class="sidebar">
WebForms Core
Dashboard
Orders
Customers
Products
Settings
class="content">
class="header">
Dashboard
class="cards">
class="card">
class="card-title">Online Users
id="OnlineUsers" class="card-value">152
class="card">
class="card-title">Orders
="Orders"class="card-value">78
class="card">
class="card-title">Revenue
id="Revenue" class="card-value">
$18450
class="panel">
Recent Orders
...
class="panel">
Last update:
id="LastUpdate">Initial load
th:utext="${WebForms}">


Top comments (0)