If you are starting a GWT project from scratch, you should use the standard GWT package layout, which makes it easy to differentiate client-side code from server-side code. For example, suppose your new project is called "Calendar". The standard package layout would look like this:
Package | Purpose |
---|---|
com/example/cal/ | The project root package contains module XML files |
com/example/cal/client/ | Client-side source files and subpackages |
com/example/cal/server/ | Server-side code and subpackages |
com/example/cal/public/ | Static resources that can be served publicly |
and examples files would be arranged like so:
File | Purpose |
---|---|
com/example/cal/Calendar.gwt.xml | A common base module for
your project that inherits com.google.gwt.user.User module |
com/example/cal/CalendarApp.gwt.xml | Inherits the com.example.cal.Calendar module (above)
and adds an entry point class |
com/example/cal/CalendarTest.gwt.xml | A module defined by your project |
com/example/cal/client/CalendarApp.java | Client-side Java source for the entry-point class |
com/example/cal/client/spelling/SpellingService.java | An RPC service interface defined in a subpackage |
com/example/cal/server/spelling/SpellingServiceImpl.java | Server-side Java source that implements the logic of the spelling service |
com/example/cal/public/Calendar.html | An HTML page that loads the calendar app |
com/example/cal/public/Calendar.css | A stylesheet that styles the calendar app |
com/example/cal/public/images/logo.gif | A logo |