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 – reading request parameters

Follow these steps and see how easy it is to use request parameters in Vaadin:

  1. Create a new Vaadin project. We are using website2 as project name.
  2. Code your UI class shown as follows:
    public class Website2UI extends UI {
    
      protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
    
        String page = request.getParameter("page");
    
        if (page == null) {
          layout.addComponent(new Label("Welcome to Simple Web Site"));
          getPage().setTitle("Simple Web Site");
    
        } else if ("1".equals(page)) {
          layout.addComponent(
              new Label("Oh yeah! You are watching Page 1!"));
          getPage().setTitle("Simple Web Site - Page 1");
    
        } else if ("2".equals(page)) { layout.addComponent(new ...

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