How to achieve multipage with GWT, such that the gwt application can have multiple EntryPoint that is mapped to a html.
Like HomeEntryPoint mapped to home.html and
EditEntryPoint mapped to edit.html and so on. Such that to load the EntryPoint it is access through the URL like this: http://localhost:8080/home.html or http://localhost:8080/edit.html
Right now I am using GWT Multipage however I think its not maintained anymore. And it has some issues that I can’t fix right now.
Issue like this.
Doing this will mean that your app will have to start back up again when the next page loads – if you are okay with this, then…
There are a few ways of doing something like this. The quickest/easiest is going to be to list all of your entrypoints in the module file, and at the top of each
onModuleLoaddo a check if it is at the right page. Something like (customized for each page/entrypoint of course):GWT will compile all the entry points (and all depending classes, to just make one set of files, each class downloaded only once) into one js file, and all entrypoints will run, but they will stop themselves if they shouldn’t be run at that time.
A step further would be to change this to use an annotation on each entrypoint, and a generator for all entrypoints (Did you know your entrypoint instance is created with GWT.create? It’s true!), which would override
onModuleLoadand add this logic automatically.Edited to use getPath() in place of getHref(), and to toLowerCase() that string to ensure that no case issues crop up