HTML Template Support

Use traditional HTML templates when they make sense. Mix and match approaches as needed.

Flexibility When You Need It

Sometimes HTML templates are the right choice. Oorian supports both approaches.

HtmlTemplatePage

Extend HtmlTemplatePage to use an HTML file as your page structure.

DOM Manipulation

Access any element by ID and modify it using standard Oorian methods.

Mix Approaches

Some pages use templates, others use pure Java. Choose per page.

Designer-Friendly

Designers can work on HTML/CSS. Developers add dynamic behavior in Java.

Full Oorian Features

Template pages still get events, SSE, WebSocket—all Oorian features work.

Easy Migration

Migrate existing HTML pages to Oorian incrementally.

How It Works

HtmlTemplatePage lets you start with an HTML file and manipulate it using standard Oorian features. There are no special placeholder syntaxes to learn—just use getElementById() and work with elements the same way you would in pure Java pages.

1

Create Template

Write a standard HTML file with elements that have ID attributes for areas you want to modify dynamically.

2

Extend HtmlTemplatePage

Create a Java class that extends HtmlTemplatePage and specify your HTML template file.

3

Access Elements

Use getElementById() to retrieve any element from the parsed DOM by its ID attribute.

4

Modify Content

Change text, set values, add child elements, register event listeners—all using standard Oorian methods.

Key Points

Standard HTML

Your template is just regular HTML. No special syntax or preprocessor required.

getElementById()

Access any element in the template by its ID, just like browser DOM APIs.

Full Oorian API

Once you have an element, use all standard Oorian methods: setText(), addElement(), registerListener(), etc.

All Features Work

Events, SSE, WebSocket, worker threads—everything works exactly as it does in pure Java pages.

When to Use Templates

Use Templates When

  • Designers need to work on HTML directly
  • You have existing HTML pages to migrate
  • The page is mostly static with some dynamic areas
  • SEO requires specific HTML structure
  • Complex layouts that are easier in HTML

Use Pure Java When

  • The page is highly dynamic
  • You want full type safety
  • Components are reused across pages
  • The team prefers a single language
  • Complex logic determines the structure