HTML + Java

Hi, all. I want to use html in my project but couldn’t find th ways how to connect html code with vaadin. I mean how to use html components in vaadin.
If you know how, help with examples also, please.

Thanks in advance!

If this question is about Vaadin 8, there are potentially many answers to this.

  1. You can render HTML content as Label by setting content mode to be HTML (see: https://vaadin.com/api/framework/8.6.3/com/vaadin/ui/Label.html#setContentMode-com.vaadin.shared.ui.ContentMode- )
  2. You can use CustomLayout if you want to use HTML as template for your layout (see: https://vaadin.com/api/framework/8.6.3/com/vaadin/ui/CustomLayout.html )
  3. You can create custom component with HTML based Polymer Elements using Elements Add-On helper (see: https://vaadin.com/directory/component/elements-add-on example implementation here: https://vaadin.com/directory/component/combobox-element)
  4. Related to above it is possible to manage HTML content via @HTMLImport annotation (see: https://vaadin.com/api/framework/8.6.3/com/vaadin/annotations/HtmlImport.html )
  5. You can create JavaScript components (somewhat related topic)

Which one of the above is the correct answer depends on what you are trying to do.

If you want to stick with Java only and want to avoid the heavy load of using JSP/servlets, there is one alternative which is to use The Play Framework.

In case you are opened to other languages too and not willing to stick with Java for UI, then you can use one of the other good web frameworks like Django(Python) or Ruby on Rails (Ruby). Then to connect you Java code to these frameworks, you can design in Java a RESTful API exposing the functionalities of your [Java]
(https://crbtech.in/online-java-training-course) code, and then connect to this API from the web framework in whatever language it is. To design the RESTful API one good option JAX-RS / Jersey with Simple Web Server but there exists some other good frameworks too.