JSF Blog post application launched
Published by BloggerToday was a remarkable day when the JSF+Vaadin hybrid blog example was launched. People around the world gathered and celebrated the event.
Today was a remarkable day when the JSF+Vaadin hybrid blog example was launched. People around the world gathered and celebrated the event.
Vaadin 14+ has support for exporting server side Java components as web components. This code exports the BlogAdmin component using the <blog-admin> tag:
public static class Exporter extends WebComponentExporter<BlogAdmin> { public Exporter() { super("blog-admin"); } @Override public void configureInstance(WebComponent<BlogAdmin> webComponent, BlogAdmin component) { // No further configuration needed in this case } }
You can then embed it anywhere using
<head> <script type="module" src="vaadin/web-component/blog-admin.js"></script> <body> <blog-admin></blog-admin>
Remember to include
<script src="vaadin/build/webcomponentsjs/webcomponents-loader.js"/></script>
in the beginning of the page to support older browsers and to deploy the servlet:
<servlet> <servlet-name>Vaadin Servlet</servlet-name> <servlet-class>com.vaadin.flow.server.VaadinServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Vaadin Servlet</servlet-name> <url-pattern>/vaadin/*</url-pattern> <!-- Can be any path --> </servlet-mapping>