|
Project Information
Featured
Links
|
"A running start for your GWT (1.6.x or 1.5.x) maven2 project" --Sam Brodkin, founder of and sole contributor to this project NewsSummary of purpose in one questionQuestion: Why is the learning curve for GWT so steep? Answer: Because there are no best practices and no good (non-trivial) sample starter apps. Solution: I'm going to walk you through a sample app. ContentsGWT: The Hype- GWT is being hyped as the easiest to develop, most maintainable way to develop cross-browser rich internet applications.
- You don't have to write any javascript or do any AJAX plumbing.
- You write everything in Java and can debug with breakpoints in hosted mode.
GWT: The reality (the difficulties)- Steep learning curve do to environment setup, asynchronous nature of RPC calls, and the restriction of only using GWT class for the front end
- No traditional webapp concept of web pages and page flow. Instead you use a more Swing-like model of swapping screens in and out
- Client state is managed on the client (and not in the session)
- Examples are mostly trivial and most of them look more like calculator widgets than webapps
- I sifted through all the GWT books and their sample apps. I also referred to the gwt maven project samples. None of them were that helpful in getting a running start. My sample app is a combo of the gwt maven project sample with some tweaks and a GWT book sample.
Don't worry help is here!I've been working on an enterprise GWT webapp for a long time. It is based on this starter app which I setup after my initial research: reading the GWT books, looking at the book examples, third-party libraries, and the GWT maven project(s). This architecture has proven it's strength to me during the development of my complex application. Project Guidelines:As with any new Java project you'd start, it should: - Be built with maven
- Be unit and integration tested (partially covered here)
- Be under continuous integration (not covered here yet)
if you disagree then you're not in the choir I'm preaching to. Architecture:It may help to refer to this picture while you're reading this A maven multiproject with: - A server project
- pure java, use what you want, integrate spring, hibernate, whatever, no problem
- will hold all domain objects in a client package (which will be shared with the client. GWT will take care of serializing them during RPC calls from the client to the server.
- XStream integration for marshaling/unmarshaling objects (in this example server options)
- A client (web) project
- All GWT classes that are eventually turned into javascript behind the scenes. You can't use your regular Java libs here!
- The client project is dependent on the server project (shares domain objects and RPC interfaces).
- Eventually produces a war artifact (which includes the server project jar).
- You can also run the web project in hosted mode which means it runs in the gwt browser.
- In hosted mode you can make a change in the code, reload the browser and see the change. You can also debug in hosted mode with breakpoints in the GWT code (before it is translated into javascript)
FAQQ: What about Spring integration on the client project side?A: See this project http://code.google.com/p/gwt-spring-starter-app/ Q: What about the maven gwt archetype?A: There is a new one that comes with the codehaus gwt-maven-plugin but it doesn't create a multiproject with separation of GWT and vanilla Java classes. What's missing from GWT?- A good mvc framework
- Built-in maven support
References:-The Codehaus gwt-maven-plugin: http://mojo.codehaus.org/gwt-maven-plugin/ -Integrating gwt incubator: http://code.google.com/p/google-web-toolkit-incubator/wiki/HowToUseTheIncubator
|