Categories
discuss

Vaadin 14 show simple HTML Page

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?

Answer

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.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..