More than one module

163 views
Skip to first unread message

GWT_AL

unread,
Jun 25, 2010, 5:27:40 PM6/25/10
to Google Web Toolkit
I need to developer a web application which has more than one main
page layout.
I was wondering how to develop more than one main page in a GWT
application.
Is it possible to have more than one Module in a GWT app (is that the
way to achieve this)?


Michael W

unread,
Jun 29, 2010, 11:59:58 PM6/29/10
to Google Web Toolkit
Yes, you can have more than one module.
If you use Maven, you can view gwt maven plugin for detail.

Katharina Probst

unread,
Jun 30, 2010, 9:25:29 AM6/30/10
to google-we...@googlegroups.com
See some documentation here:

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Chris Boertien

unread,
Jun 30, 2010, 3:08:40 PM6/30/10
to google-we...@googlegroups.com
This is just a suggestion off the top of my head and may or may not
work as i think it will.

To address your case I would setup 1 Module for the entry point and
use it to choose which of the other Module's to load for the main
page. I think this should allow you to take the most advantage of code
splitting so as not to load any of the data for one page when the
other is chosen.

Something like...
// PageChooserEntryPoint.onModuleLoad()

if(loadPageOne) {
GWT.runAsync(new AsyncCallback() {
(new PageOneEntryPoint).onModuleLoad();
});
} else {
GWT.runAsync(new AsyncCallback() {
(new PageTwoEntryPoint).onModuleLoad();
});
}

Im not sure if thats the best way to go about it, but its the first
thing that came to mind.

Brian Reilly

unread,
Jul 1, 2010, 12:45:18 PM7/1/10
to Google Web Toolkit
You could also check out gwt-multipage (http://code.google.com/p/gwt-
multipage/) which basically does this type of switching, but it
generates the switching code for you based on annotated entry points.
You can switch based on a URL pattern (and hopefully soon by a
javascript token variable... and possibly others in the future... see
http://claudiushauptmann.com/a-framework-for-gwt-multipage-applications.html).

This works well for integrating GWT into an existing application where
you want to keep the header/footer/nav/etc. but want to add features
using GWT. However, if you're developing a new application, I would
suggest you also consider displaying all your application views from a
single host page instead and making use of GWT's history support.

-Brian

On Jun 30, 3:08 pm, Chris Boertien <chris.boert...@gmail.com> wrote:
> This is just a suggestion off the top of my head and may or may not
> work as i think it will.
>
> To address your case I would setup 1 Module for the entry point and
> use it to choose which of the other Module's to load for the main
> page. I think this should allow you to take the most advantage of code
> splitting so as not to load any of the data for one page when the
> other is chosen.
>
> Something like...
> // PageChooserEntryPoint.onModuleLoad()
>
> if(loadPageOne) {
>   GWT.runAsync(new AsyncCallback() {
>     (new PageOneEntryPoint).onModuleLoad();
>   });} else {
>
>   GWT.runAsync(new AsyncCallback() {
>     (new PageTwoEntryPoint).onModuleLoad();
>   });
>
> }
>
> Im not sure if thats the best way to go about it, but its the first
> thing that came to mind.
>
>
>
> On Wed, Jun 30, 2010 at 7:25 AM, Katharina Probst <kpro...@google.com> wrote:
> > See some documentation here:
> >http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjec...
Reply all
Reply to author
Forward
0 new messages