HTML
Juneau supports converting arbitrary POJOs to and from HTML using ultra-efficient serializers and parsers.
The HTML support is built on top of the XML support. The HtmlSerializer converts POJOs directly to HTML without the need for intermediate DOM objects, and the HtmlParser uses a STaX-based reader to reconstruct POJOs directly from that same markup. Like the rest of Juneau, no annotations are required on your POJOs — beans and maps render as tables, collections and arrays render as bulleted lists, and simple values render as text with lightweight type tags where the datatype cannot be inferred through reflection.
The primary use case for HTML marshalling is rendering POJOs in an easy-to-read format in REST interfaces. For that use case, the HtmlDocSerializer wraps the serialized POJO inside a complete HTML document (header, nav, aside, article, and footer sections) so that a bean can be rendered as a self-contained, styled web page.
Serializer and parser families
- HtmlSerializer / HtmlParser — convert POJOs to and from HTML fragments (tables and lists).
- HtmlDocSerializer — extends
HtmlSerializerto wrap the fragment inside a full HTML document driven by a customizable page template. Its output is also readable back in byHtmlParser. - HtmlSchemaSerializer — produces HTML renderings of the JSON-Schema documents that describe your serialized output.
In this section
- HTML Methodology — how each POJO datatype is represented in HTML.
- HTML Serializers — the
HtmlSerializerclass, its builder hierarchy, and the pre-configured serializers. - HTML Parsers — the
HtmlParserclass, its builder hierarchy, and the pre-configured parsers. - @Html Annotation — customizing HTML output on a per-class/field/method basis.
- @Html(render) Annotation — custom CSS/content rendering of individual bean-property values.
- HtmlDocSerializer — wrapping serialized POJOs in a complete HTML document.
- BasicHtmlDocTemplate — the default document template and its page structure.
- Custom Templates — implementing your own
HtmlDocTemplate. - HTML-Schema Support — generating HTML views of JSON-Schema documents.
See Also
- Marshallers for the marshaller API overview.
- XML for the XML support that HTML marshalling is built on.