Vaadin 14 - Generate multiple different pages automatically

Hey I am trying to generate a new page with its own content, without needing to manually create a class for it:

int amount = 10;
        for (int i = 0; i < amount; i++) {
		//generate new page with own url like:
		String url = "test"+i;
		}
		/*
		At the end there should be 10 new pages generated like:
		www.example.com/test1
		www.example.com/test2
		www.example.com/test3
		...
		*/

Any ideas how to make this possible?
Cause vaadin makes it all the time. This post for example was generated automatically. There is not a dude creating a new class for every user post each time.

https://vaadin.com/forum/thread/18354615/

This post for example was generated automatically.

No it wasn’t. There is a View class for a Forum Thread, where you give a parameter so the view knows which information to load.

If you look at this URL right here, you might notice the pattern https://vaadin.com/forum/thread/[[some-id] ]/[[thread_title] ], so I’m pretty sure there is 1 View defined with @Route("forum/thread") and implements HasUrlParameter<...>

For your example, you would create 1 TestView class that expects a numerical parameter (1, 2, 3, …)

@Route("test")
public class TestView extends VerticalLayout implements HasUrlParamter<Integer> {
	
	public class TestView(){
	
	}

    @Override
    public void setParameter(BeforeEvent beforeEevent, Integer testId) {
        // TODO: load test data with id == testId, and add/fill your layouts / bind your inputs.
    }
}

the url for this view would be like this: www.example.com/test/1, www.example.com/test/2, www.example.com/test/4123

Docs: [Routing and url parameters]
(https://vaadin.com/docs/flow/routing/tutorial-router-url-parameters.html)

Kaspar Scherrer:

This post for example was generated automatically.

No it wasn’t. There is a View class for a Forum Thread, where you give a parameter so the view knows which information to load.

If you look at this URL right here, you might notice the pattern https://vaadin.com/forum/thread/[[some-id] ]/[[thread_title] ], so I’m pretty sure there is 1 View defined with @Route("forum/thread") and implements HasUrlParameter<...>

For your example, you would create 1 TestView class that expects a numerical parameter (1, 2, 3, …)

@Route("test")
public class TestView extends VerticalLayout implements HasUrlParamter<Integer> {
	
	public class TestView(){
	
	}

    @Override
    public void setParameter(BeforeEvent beforeEevent, Integer testId) {
        // TODO: load test data with id == testId, and add/fill your layouts / bind your inputs.
    }
}

the url for this view would be like this: www.example.com/test/1, www.example.com/test/2, www.example.com/test/4123

Docs: [Routing and url parameters]
(https://vaadin.com/docs/flow/routing/tutorial-router-url-parameters.html)

Is there a way to pass over multiple different values?
For example, the page should contain a unique id(int) in its html and a unique name(string) in its url.

Url: www.example.com/uniqueName

Page content(html):

<h1>uniqueId</h1>
int amount = 10;
        for (int i = 0; i < amount; i++) {
		//Generate new Page, with parameters
		ExamplePage p = new ExamplePage(int uniqueId, String uniqueName);
		
		}
		/*
		At the end there should be 10 new pages generated like:
		www.example.com/test1
		www.example.com/test2
		www.example.com/test3
		...
		*/