Installation and First Static Page
Dependency
Use JDK 21 or later to build and run SimplyPages. From the repository root, first run
./mvnw -pl simplypages install to install this beta version locally. For a complete
runnable example, see your first page.
Add SimplyPages to your pom.xml:
Current release: 1.2.1.
<dependency>
<groupId>io.mindspice</groupId>
<artifactId>simplypages</artifactId>
<version>1.2.1</version>
</dependency>
Toolchain
- Use the repository Maven wrapper (
./mvnw) for local builds. - Both framework and site target Java 21 bytecode.
- Build the reactor and run either module with JDK 21 or later.
First Static Page
@GetMapping("/about")
@ResponseBody
public String aboutPage() {
Page page = Page.builder()
.addComponents(Header.H1("About"))
.addComponents(new Paragraph("This page is server rendered."))
.build();
return page.render();
}
Serve a Page Built Once
For content that changes rarely, build and render once, then serve cached HTML.
@Service
public class StaticPageService {
private String docsHtml;
@PostConstruct
void init() {
docsHtml = Page.builder()
.addComponents(Header.H1("Documentation"))
.addComponents(new Markdown("Static content generated at startup."))
.build()
.render();
}
public String docsHtml() {
return docsHtml;
}
}
@GetMapping("/docs")
@ResponseBody
public String docs(StaticPageService service) {
return service.docsHtml();
}
When This Pattern Fits
- Marketing pages with infrequent updates
- Internal policy pages
- Versioned docs snapshots
For request-time dynamic data, use slots and render context (next guide).