Wednesday, April 15, 2009

GWT Project Basics

GWT projects consist of three elements:

  1. Module, module-name.gwt.xml
  2. Host, module-name.html
  3. Code,

Module defines the entry point, which is found inside the code file. After creating the code file, add line similar to:
<entry-point class="MyProject.client.MyCodeClass" />
to the module XML file.

The code file implements the EntryPoint interface. This file contains onModuleLoad() function, which is similar to main() in C or Java. Additional classes can be implemented as simple Java classes. They should import needed namespaces. This is done automatically by Eclipse. The resulting code for the application is very similar to C# or Java. The only thing missing is the designer support for UI classes. It would be extremely nice to have a designer to produce user interface and event linking automatically and/or visually.

HTML file contains a link to generated JavaScript file(s). This link is created automatically if you use Eclipse and GWT plugin. During the creation of HTML file in Eclipse there is an option to select the module(s) to be used. All the modules in the project get included in the HTML file by default. You should include only the modules that will be actually used on the host page. The other code files (.java) can be shared among different modules. HTML files can be left blank if the UI is to be manipulated completely in code, or it can contain some UI elements as well. These are usually only containers that will contain other elements which will be defined in code. One HTML host page can host multiple GWT applications. In that case, each application should have its separate container and not use the whole RootPanel (page body).


Anonymous said...

is multiple pages not at all possible for GWT web application projects .

in future can this problem be solved . i hereby require a solution for this as the project in our company is about to undertake in GWT , its very important for me to go with the proper understanding of the GWT basics such that if there is a possibility i Can enhance my Learning skills in GWT to make up with the PRoject

-=|MisterY|=- said...

Hi Naga,

Well, it was the case when I was working with GWT that multiple pages do not fit into the concept. Haven't looked into GWT lately as I'd found jQuery and plugins to be quite good for most of my needs nowadays.

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

Hi Sir,

Thx Very Much for the reply.

Anonymous said...

I need your suggestion with regards the Project.

Recently a few days back i was assigned to develop a Ecommerce Project using Eclipse with GWT. The requirement is in such a way that the Project Contains more than 50 Pages.tasks like - Page navigations , session exchange etc will come in to it.

My area of doubt was, as the Eclipse with GWT web project contains by default a Single HTML page and a single Entry Point. can the Ecommerce Project be build or developed using Eclipse with GWT web Project (more than 50 pages html) under this case with the following requirements sir.

I hereby require a suggestion or idea with regarding to it.

Anonymous said...

My Last Doubt Sir,

is GWT (google web toolkit) according to latest version does it support multiple HTML Pages (to create or develop) with in a single project. As like in DOTNET,PHP we have several pages

-=|MisterY|=- said...

Hmmm... I think it will be very difficult. You will have to have a backend - either PHP, Java, .Net or something else. GWT produces JavaScript code which is executed on the client side.
So, you have to decide on the platform for the backend, otherwise it would be very difficult to do everything in JavaScript. I'm not sure if GWT would work well with a backend. Have a look at JQuery for the front end and any backend will work. There may be some Open Source solutions available in PHP, too. Good luck!

Anonymous said...

Thx Sir for the reply,

As of now i developed some sample project like this sir.

I have created a Eclipse with GWT project and developed a Normal Form to enter data. and two button.

And again I have created a another new project using Eclipse with GWT and developed a Datagrid using GWT

Both the projects incluse PHP with my sql as back end.

The maintenance is like this sir. using Project 1 im sending the Entered details in the form to my sql database using GWT (by PHP interface)

and using project2 im the GWT datagrid display all the JSON DATA from the PHP file which the PHP file is connected to the Mysql

These two projects are developed independetly and later clubbed as one as the Eclipse with GWT project contains only 1 HTML page i have gone to this kind of requirements can these things can be done using a single project to reduce the complexity under multiple HTML files.

Anonymous said...

sir, can i have ur yahoo or gmail ID for discussion. if u insist sir i can proceed with the help of ypu sir.

Once again thx sir.