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

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?

public void setParameter(BeforeEvent event, Long parameter) { = parameter;

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


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

ui → {

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: