RouterLink sample for navgation target with and without URL parameter
GreetingComponent with URL parameter
To trigger navigation from the server side, use UI.navigate(String)
, where the string parameter is the location to navigate to. Also available is , or navigate(Class<? extends C> navigationTarget, T parameter)
so you don’t have to generate the route string manually. This will trigger the updating of the browser location and add a new history state entry. An example navigation to the company
route target when clicking a button:
Java
Note | Router links will work even if the session has expired so you should prefer to use those instead of handling navigation server side. |