6

I made some kind of internal manual for a webapp that i am developing. I am using Spring Boot and Vaadin 14. How to implement a button that shows that document? The html doc is in my resources folder. I wonder if i am stupid. Or should i write my own controller for this?

Stimpson Cat
  • 1,444
  • 19
  • 44

1 Answers1

4

A Vaadin application itself is a single dynamic HTML page.

The easiest way to include HTML formatted content (not an HTML document) is to use the Html component.

Html html = new Html("<div><h3>Title</h3><p><b>Bold summary text</b></p><p>Other text</p></div>");
layout.add(html);

Note, when you use the Html component, you need to strip the <head> and <body> tags, as Html's purpose is not to show full HTML documents. The Html component's content should be included inside a single root element - usually a <div> is used for this purpose.

However, based on your use case, I think the Html component will serve you well.

ollitietavainen
  • 3,900
  • 13
  • 30
Tatu Lund
  • 9,949
  • 1
  • 12
  • 26