Colleagues, I try to understand with Vaadin Routers. The documentation https://vaadin.com/docs/v13/flow/routing/tutorial-router-url-parameters.html literally says that the setParameter method should be called by the router before the route itself is activated. I observe exactly the opposite situation. The setParameter method is called after the constructor (which, in principle, can be understood), after the initialization method marked with the @PostConstruct annotation … Moreover, although the setParameter method is called in the passed parameter, it is empty !! ?? I give the text of the classes below:
@Route(“first”)
public class First extends Div {
public First() {
NativeButton button = new NativeButton(“click me”);
button.addClickListener(e → {
Map<String, String> map = new HashMap<>();
map.put(“id”, “Hello”);
QueryParameters parameters = QueryParameters.simple(map);
button.getUI().ifPresent(ui → ui.navigate(“second”, parameters));
});
add(button); }
}
@Route(“second”)
public class Second extends Div implements HasUrlParameter {
public Second(){
}
@PostConstruct
void init(){
}
@Override public void setParameter(BeforeEvent event, String parameter) {
setText("Parameter " + parameter);
}
}
Thanks in advance)