{title:'@HtmlDocConfig', updated:'8.1.0,9.0.0'}

The {@link oaj.html.annotation.HtmlDocConfig @HtmlDocConfig} annotation is used to customize the HTML view of POJOs serialized by {@link oaj.html.HtmlDocSerializer}.

- {@link oaj.html.annotation.HtmlDocConfig}
  - {@link oaj.html.annotation.HtmlDocConfig#aside() aside}
  - {@link oaj.html.annotation.HtmlDocConfig#asideFloat() asideFloat}
  - {@link oaj.html.annotation.HtmlDocConfig#footer() footer}
  - {@link oaj.html.annotation.HtmlDocConfig#head() head}
  - {@link oaj.html.annotation.HtmlDocConfig#header() header}
  - {@link oaj.html.annotation.HtmlDocConfig#nav() nav}
  - {@link oaj.html.annotation.HtmlDocConfig#navlinks() navlinks}
  - {@link oaj.html.annotation.HtmlDocConfig#noResultsMessage() noResultsMessage}
  - {@link oaj.html.annotation.HtmlDocConfig#nowrap() nowrap}
  - {@link oaj.html.annotation.HtmlDocConfig#rank() rank}
  - {@link oaj.html.annotation.HtmlDocConfig#script() script}
  - {@link oaj.html.annotation.HtmlDocConfig#style() style}
  - {@link oaj.html.annotation.HtmlDocConfig#stylesheet() stylesheet}
  - {@link oaj.html.annotation.HtmlDocConfig#template() template}
  - {@link oaj.html.annotation.HtmlDocConfig#widgets() widgets}

It's used in the following locations:

- {@link oajr.annotation.Rest @Rest}-annotated classes.
- {@link oajr.annotation.RestOp @RestOp}-annotated methods.

For example, the following shows setting the title on a page:

| @Rest | @HtmlDocConfig( | title="My Resource Page" | )

The purpose of this annotation is to populate the HTML document view which by default consists of the following structure:

| <html> | <head> | <style type='text/css'> | CSS styles and links to stylesheets | </style> | </head> | <body> | <header> | Page header | </header> | <nav> | Navigation links | </nav> | <aside> | Side-bar text | </aside> | <article> | Contents of serialized object | </article> | <footer> | Footer message | </footer> | </body> | </html>

The outline above is controlled by the {@link oaj.html.HtmlDocTemplate} interface which can be overridden via the {@link oaj.html.annotation.HtmlDocConfig#template() @HtmlDocConfig(template)} annotation.

The HelloWorldResource class was an example of the @HtmlDocConfig annotation in use:

| /** | * Sample REST resource that prints out a simple "Hello world!" message. | */ | @Rest( | path="/helloWorld" | ) | @HtmlDocConfig( | navlinks={ | "up: request:/..", | "options: servlet:/?method=OPTIONS" | }, | aside={ | "<div style='max-width:400px' class='text'>", | " <p>This page shows a resource that simply response with a 'Hello world!' message</p>", | " <p>The POJO serialized is a simple String.</p>", | "</div>" | } | ) | public class HelloWorldResource extends BasicRestServlet {...}

SVL variables can be used in any of these annotations:

| @Rest( | path="/helloWorld", | // Register a config file. | config="MyConfig.cfg" | ) | @HtmlDocConfig( | navlinks={ | "up: request:/..", | "options: servlet:/?method=OPTIONS", | // Add a nav link to view the source code for this class. | "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java" | }, | aside={ | // Localize our messages. | "<div style='max-width:400px' class='text'>", | " <p>$L{localizedMessage1}</p>", | " <p>$L{localizedMessage2}</p>", | "</div>" | } | ) | public class HelloWorldResource extends BasicRestServlet {...}