Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
I have a vaadin application with views in it and i have to navigate from one view to another. I am initaializing the view in the UI class and adding all the views. Now to use that navigator in the views can i create a new navigator variable in the views and initialize it from the enter method using event.getNavigator(). Is this the right way to do it or is there any other way.
Asking this since it might make the view class stateful,It has to preserve the variable across requests.
The UI class has the methods setNavigator and getNavigator, which you can use to store and access your Navigator instance. You can get the current UI with the static UI.getCurrent() accessor.
The first argument in Navigator's constructor defines the UI for Navigator and Navigator registers itself for the UI by calling ui.setNavigator(this). So no need to call ui.setNavigator expiclitly.
Navigator can be accessed from UI by calling ui.getNavigator(), and components have getUI(), which means that when a component is attached to a UI, the following works:
I want to know if Vaadin preserves the variable values across the requests, if it is stateful or stateless.