URL Parameters can be extracted and tied to certain data items in the view descriptor. However utilizing custom parameters in the URL to do things such as pass a code on a custom public web form is not currently documented.
To utilize the custom URL parameter we have to extract the current URL from the Vaadin render service:
UI.getcurrent().getPage().fetchCurrentURL(currentUrl ->
This draws the currentUrl as the parameter currentUrl that can then be parsed, but must be parsed and used as an arrow function. Then the URL can be parsed as a MultiValueMap<String, String>, I’ve included a full example for passing a confirmation code on the completion of a web form so the user can see the confirmation code on the public facing page.
This is a good utilization for security minded web form submissions, such as developing a separate web stack for submission forms that has a limited write only permission to only specific data tables, thus requiring that the uuid written be passed to the next screen for display since it cannot be read out of the database.
UI.getCurrent().getPage().fetchCurrentURL(currentUrl -> {
MultiValueMap<String, String> queryParams = UriComponentsBuilder.fromUriString(String.valueOf(currentUrl)).build().getQueryParams();
confirmationCodeField.setValue(Objects.requireNonNull(queryParams.getFirst("confirmationCode")));
});
Thank you,
Oran