In this tutorial, I show you how create a basic hello world on Vaadin with eclipse, maven and jetty, step by step. See the video in my channel and the snippet in this blog.
POM.xml:
4.0.0 org.moumie Vaadinlet03 0.0.1-SNAPSHOT war Vaadinlet03 Maven Webapp http://www.example.com UTF-8 1.8 1.8 7.7.1 7.7.1 9.3.9.v20160517 vaadin-addons http://maven.vaadin.com/vaadin-addons vaadin-snapshots https://oss.sonatype.org/content/repositories/vaadin-snapshots/ false true com.vaadin vaadin-bom ${vaadin.version} pom import junit junit 4.11 test javax.servlet javax.servlet-api 3.1.0 provided com.vaadin vaadin-server com.vaadin vaadin-push com.vaadin vaadin-client-compiled com.vaadin vaadin-themes org.eclipse.jdt.core.compiler ecj 4.6.1 com.vaadin vaadin-client-compiler ${vaadin.version} provided Vaadinlet03 maven-clean-plugin 3.1.0 maven-resources-plugin 3.0.2 maven-compiler-plugin 3.8.0 maven-surefire-plugin 2.22.1 maven-war-plugin 3.2.2 maven-install-plugin 2.5.2 maven-deploy-plugin 2.8.2 org.eclipse.jetty jetty-maven-plugin ${jetty.plugin.version} 2 vaadin-prerelease false vaadin-prereleases http://maven.vaadin.com/vaadin-prereleases vaadin-prereleases http://maven.vaadin.com/vaadin-prereleases
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
public class Vaadinlet03UI extends UI{
private static final long serialVersionUID = 1L;
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
Label label = new Label("Hello World Vaadin !");
layout.addComponent(label);
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
}
@WebServlet(urlPatterns = "/*", name = "Vaadinlet03UIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = Vaadinlet03UI.class, productionMode = false)
public static class Vaadinlet03UIServlet extends VaadinServlet {
}
}