Search code examples
user-interfacevaadinvaadin7

Navigation between differents UI in vaadin project


please I have a vaadin project with 2 UI ,I want to go from the first UI to the second by clicking a button. Have you any idea how can I do it .Thank you


Solution

  • Typically a Vaadin application only contains just a single UI, and then Vaadin Navigator is used to switch between different views.

    But sometimes there is a valid use case for multiple UIs inside the same application.

    If you have multiple UIs, to open the UI, which is running in the context root of your web app, you could just say:

    getUI().getPage().setLocation("/");
    

    and if you have an another UI running at path second, you can open it by calling:

    getUI().getPage().setLocation("/second");