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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to assign parameter value in url.
Good day, I wanted to create a price checking application for a local retail company. Is there a way to change parameter/variable in the URL. I ask this because the store has two locations. The item price differ base on location.
The easiest way is probably to use Vaadin's Navigator-API and work with a View Parameter. See https://vaadin.com/docs/-/part/framework/advanced/advanced-navigator.html#advanced.navigator.urifragment
You can use the Navigator#navigateTo(String navigationState) method and just add the parameter. For example, if the name of your store view is "store", then when navigating to a particular store you could have something like:
getUI().getNavigator().navigateTo("store" + "/" + "id_of_store");
This will navigate you to the store view and add the id parameter to the URL. Then in the store view implementation, read the parameter from the ViewChangeEvent object that is passed to the View#enter(ViewChangeEvent event) method such as:
@Override
public void enter(ViewChangeEvent event) {
String storeId = event.getParameters();
//.. fetch prices for store and update UI
}
After this fetch the prices based on the store id and update the prices in the UI accordingly.
Hope this helps,
Goran