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?
Vaadin 14 show simple HTML Page
Asked Answered
Do you want to redirect the user to a separate browser tab / page, or show the document inside your Vaadin UI, or something else? –
Caddy
It does not matter, A new page is okay –
Tapeworm
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.
Thanks Tatu now i must change my html to be compliant –
Tapeworm
© 2022 - 2024 — McMap. All rights reserved.