Wednesday, February 9, 2011

Multiple Modules in Google Web Toolkit (GWT)

Sometimes you may want to have a GWT application that has multiple EntrePoints/Modules. An example of this may be an Administration module. If your host page is MyApp.html and your Module and Entrypoint is MyApp.gwt.xml and MyApp.java, you can always add MyAdmin.html in the war directory and add the new module.

1) Add the new host file
2) Add another gwt.xml module file
3) Add the new module
4) Update your build xml

Since you may have a gwt app configured slightly different, I will add my details here and you can adjust them if needed

com.myapp/
- MyApp.gwt.xml
- MyAdmin.gwt.xml ()


com.myapp.client.admin
- MyAdmin.java (extends EntryPoint)
- com.myapp.client.admin.activity
- com.myapp.client.admin.place
- com.myapp.client.admin.etc



com.myapp.client.main
- MyApp.java (extends EntryPoint)
Sometimes you may want to have a GWT application that has multiple EntrePoints/Modules. An example of this may be an Administration module. If your host page is MyApp.html and your Module and Entrypoint is MyApp.gwt.xml and MyApp.java, you can always add MyAdmin.html in the war directory and add the new module.

1) Add the new host file
2) Add another gwt.xml module file
3) Add the new module
4) Update your build xml

Since you may have a gwt app configured slightly different, I will add my details here and you can adjust them if needed

com.myapp/
- MyApp.gwt.xml
- MyAdmin.gwt.xml ()


com.myapp.client.admin
- MyAdmin.java (extends EntryPoint)
- com.myapp.client.main.activity
- com.myapp.client.main.place
- com.myapp.client.main.etc

war/
- MyApp.html:
- MyAdmin.html:

build.xml:


















You may want to structure this a little bit different based on how connected the modules are or what your particular use is..
You may also need to work with the web.xml or servlets file depending on your configuration (rpcs coming into /MyApp/something and /MyAdmin/something.rpc