App with URL parameter

I need to pass a parameter to my Vaadin 14 application. For example: localhost:8080/myapp/parameter. I tried to get the “parameter” in the main View as below:

@Route(value = "MainView", layout = MainLayout.class)
@RouteAlias(value = "", layout = MainLayout.class)
@PageTitle("BCD NFSe")
public class MainView extends FlexLayout implements HasUrlParameter<String> {...

However, the setParameter(BeforeEvent event, String t) method is not called.
Can someone help me?

HasUrlParameter is a typed interface, in your case it should be implements HasUrlParameter<String>.
Now your MainView can have a String parameter, but for this to work you need to navigate to the mainview → localhost:8080/MainView/testparam or localhost:8080/myapp/MainView/testparam depending on your setup. The method setParameter(BeforeEvent event, String t) should now be called.

Thank you very much. It worked.