O'Reilly logo

Vaadin 7 UI Design By Example Beginner's Guide by Alejandro Duarte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – developing a simple website

Let's see how we can do this using Vaadin.

  1. Start up your IDE and create a new Vaadin project. We are using website as project name.
  2. Code your UI class as shown in the following code snippet:
    public class WebsiteUI extends UI {
    
      protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
    
        String page = request.getPathInfo();
    
        if (page == null || page.isEmpty() || "/".equals(page)) {
          layout.addComponent(new Label("Welcome to Simple Web Site"));
          getPage().setTitle("Simple Web Site");
    
        } else if ("/page1".equals(page)) { layout.addComponent( new Label("Oh yeah! You are watching Page 1!")); getPage().setTitle("Simple Web Site – Page ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required