I have previously used the same approach Isaac suggests in some tests,
when asked this same question, and it seemed to work pretty well.
Disclaimer: I have never used this with a big production app, only
some proof of concept stuff.
Using a single module gets you one download, nice. Then each page
loads that module, and in my case I used a Dictionary to set a name/
value pair on each page, pageId/whatever. Then the EntryPoint loads
the dictionary and using a a big case/switch fires off the needed
widgets for the current page (and places them inside a particular div
or divs, using the elementId).
Something like this:
Host Page:
http://totsp.com/svn/repo/MultiPageExample/trunk/src/main/resources/com/manning/gwtip/example/public/page1.html
Entry Point:
http://totsp.com/svn/repo/MultiPageExample/trunk/src/main/java/com/manning/gwtip/example/client/MultiPageExample.java
If anybody has used this in the wild on a prod app, or any other
approach to integrating widgets on a site that already has a bunch of
pages, I would like to hear about what did and did not work.
(You could also do the module per page thing, and each module could be
stupid simple, re-using the same code base for the widgets, but then
every page would have to download a new module, that's less than
ideal.)
On Jan 18, 11:12 am, "Isaac Truett" <
itru...@gmail.com> wrote:
> Many approaches could work. One would be to create a single module
> where the entry point checks for multiple IDs on the page and inserts
> a widget into any that are found (i.e., RootPanel.get("someId")
> doesn't return null). One of the advantages to this approach compared
> to multiple modules is a one-time download upfront that gets loaded
> from cache as the user navigates between pages.
>