Vaadin 23 - URL Parameter (long) is received as 0

Hi,
My view implements HasUrlParameter.

The parameter I give is visible in the URL on browser, but when I try to access it, the value is 0.

Can show the code of setParameter?

@Override
public void setParameter(BeforeEvent event, Long parameter) {
this.id = parameter;
}

How is it visible in the URL? /view/1 or /view?q=1 or something else?

view/1

Also the class’s route is defined as @Route(value = “my-view/:id?/”, layout = MyLayout.class)

The button that does the routing has this click event

Button.getUI().ifPresent(
ui → {
ui.navigate(MyView.class,myObject.getId());
}));

You are using a route template. The you cannot use setParameter because there could be many

You have to get the parameter in the beforeEnter method of BeforeEnterObserver

So my class should implement BeforeEnterObserver

Thanks :pray: