Introduction
JWeb is a Java web framework for building complete web applications entirely in Java. No direct HTML, CSS, or JavaScript writing - just Java.
Why JWeb?
- HTML DSL - Java methods that generate HTML with compile-time safety
- CSS DSL - Java fluent methods that generate CSS with full IDE support
- No npm/webpack - Just Maven, like any Java project
- Spring Boot powered - Production-ready from day one
- Reactive state - Built-in state management for dynamic UIs
JWeb uses static imports for a clean DSL. Add: import static ...Elements.*;
Hello World
public class HelloPage implements Template {
public Element render() {
return h1("Hello, World!");
}
}With Styling
public Element render() {
return div(attrs().style()
.padding(rem(2))
.backgroundColor(hex("#f5f5f5")).done(),
h1("Welcome to JWeb"),
p("Build web apps in pure Java")
);
}How It Works
JWeb renders Java objects to HTML on the server. The HTML DSL provides methods that generate markup. The CSS DSL uses fluent builders for styles.