Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Proper way to switch UI ?

Jean-François Lamy
5 years ago Feb 26, 2017 7:18pm
Alejandro C De Baca
5 years ago Feb 28, 2017 10:15pm


The UI is the root component for an entire Vaadin application. Each UI is unaware of the existence of others. You could always use Link objects for navigation in your current architecture, and perhaps use @SpringUI("") instead of @SpringUI("/app") to move your NavigationUI class up in the URL hierarchy so that spring will map the servlet root to your navigation page.

However, I think the issue here is the architecture of your application. For a multi-view app, the Vaadin tool of choice is Navigator. The approach would be to have a single UI class that would be above the navigation screen and the public information displays. With that, you would use a .navigateTo("viewName") call from anywhere in the app. You would have to refactor your code a little, as you would need to move your UI init() methods into object constructors of new component classes that implement the View interface. I'm happy to explain in more detail if that's an avenue you are interested in exploring.