Creating a new GWT project

Having discussed the starter GWT web project, we will create a new GWT web application. Select File | New | Other in Eclipse. In New, select Google | Web Application Project and click on Next, as shown in the following screenshot:

Creating a new GWT project

The New Web Application Project wizard gets started. Specify Project name (gwt-jboss-ajax) and Package (org.jboss.gwt). Select the default setting for Location. In Google SDKs, click on the Use Google Web Toolkit checkbox and click on Configure SDKs, as shown in the following screenshot:

Creating a new GWT project

A filtered version of Preferences gets listed with only Google | Web Toolkit. Click on Add to add a new SDK, as shown in the following screenshot:

Creating a new GWT project

In Add Google Web Toolkit SDK, select Installation directory for GWT 2.6 (C:gwt-2.6) with Display name as gwt-2.6.0, as shown in the following screenshot. Then, click on OK.

Creating a new GWT project

A GWT SDK gets added to Preferences, as shown in the following screenshot:

Creating a new GWT project

In the New Web Application Project wizard, click on the Create a Web Application Project window. Click on Finish.

Creating a new GWT project

A Google Web Application project, which is essentially a GWT project, gets created with the directory structure shown in the following screenshot:

Creating a new GWT project

A typical GWT web project consists of the following files, modules, and pages:

  • Client Java source files to be compiled into JavaScript. GWT widgets from the GWT SDK Java API can be added to the client Java source files.
  • Server Java source files, which can implement some service logic.
  • GWT modules, which specify the configuration for the GWT project. GWT libraries are called modules.
  • HTML host pages to run the GWT modules.

We will create a GWT web application to create a catalog entry with an input form. The input widgets for the input form will be specified in a client Java source file. A GWT module will specify the configuration. An HTML host page will run the module in a browser. As GWT widgets support Ajax, we will validate a new catalog entry dynamically with Ajax. Before we create a new GWT project, delete the files created in the default Google Web Application project, except the gwt-jboss-ajax project root folder, the subdirectories in the src folder, and the war directory, including the web.xml deployment descriptor in the //gwt-jboss-ajax/war/WEB-INF folder. Add a pom.xml file (select XML | XML File in the New wizard) for a Maven project to the root folder /gwt-jboss-ajax. The directory structure of the gwt-jboss-ajax project is shown in the following screenshot:

Creating a new GWT project
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset