I am trying to use templates with Vaadin 10 in a Spring-Boot application.
The problem is, that the template is not used when the page is displayed. No components of the template are appearing on the page.
My template PersonForm.html
is stored in src/main/resources/META-INF/resources/frontend/src
.
The class which is trying to bind them is:
@Route
@Tag("person-form")
@HtmlImport("frontend://src/PersonForm.html")
public class PersonView extends VerticalLayout implements HasUrlParameter<String> {
public PersonView() {}
@Override
public void setParameter(BeforeEvent event, String parameter) {}
}
It's right to put the templates in src/main/resources/META-INF/resources/frontend
. For Spring-Boot at least this is the default folder.
The Problem is, that your class which is using the template, must extend PolymerTemplate<TemplateModel>
.
Instead of TemplateModel
you can use your own model.
This will work:
@Tag("person-form")
@HtmlImport("frontend://src/PersonForm.html")
public class PersonView extends PolymerTemplate<TemplateModel> implements HasUrlParameter<String> {