Java J2EE Portal
Enterprise Java Station
J2EE curve
Java News / Articles
Java News / Articles
Become a better Java developer, benefit from Open Source
Integrating and Interoperating between J2EE and .NET Solutions
Simplified BPM integration with JBoss jBPM
Processing...
Buy Java, Deals On Software Technology Store
Click here for great deals on computers, laptops, software and books
Creating a new Google Web Toolkit (GWT) application PDF Print
Written by Content Team   
Apr 02, 2007 at 02:04 AM

HelloGWT.html: The host page that functions as the main HTML page for the HelloGWT application.

gwt.js: A generated JavaScript file that contains bootstrap code for loading and initializing the GWT framework.

History.html: An HTML file that provides history management support.

xxx-cache.html and xxx-cache.xml: One HTML and XML file per supported browser are generated. These contain the JavaScript code generated by the compilation of the source Java files in the com.packtpub.gwtbook.hellogwt.client and com.packtpub.gwtbook.hellogwt.server packages. For instance, in this case, on Windows, the compilation produced these files:

0B0ADCCCE2B7E0273AD2CA032DE172D1.cache.html
0B0ADCCCE2B7E0273AD2CA032DE172D1.cache.xml
224EDC91CDCFD8793FCA1F211B325349.cache.html
224EDC91CDCFD8793FCA1F211B325349.cache.xml
546B5855190E25A30111DE5E5E2005C5.cache.html
546B5855190E25A30111DE5E5E2005C5.cache.xml
D802D3CBDE35D3663D973E88022BC653.cache.html
D802D3CBDE35D3663D973E88022BC653.cache.xml

Each set of HTML and XML files represents one supported browser:

0B0ADCCCE2B7E0273AD2CA032DE172D1 - Safari
224EDC91CDCFD8793FCA1F211B325349 - Mozilla or Firefox
546B5855190E25A30111DE5E5E2005C5 - Internet Explorer
D802D3CBDE35D3663D973E88022BC653 - Opera

The file names are created by generating Globally Unique Identifiers (GUIDs) and using the GUID as part of the name. These file names will be different on different computers, and will also be different every time you do a clean recompile of the application on your computer. There is also a master HTML file generated (com.packtpub.gwtbook.hellogwt.HelloGWT.nocache.html) that selects the right HTML file from the above files and loads it, depending on the browser that is running the application.

The www folder does not contain the code from thecom.packtpub.gwtbook.hellogwt.server package. This server code needs to be compiled and deployed in a servlet container so that the client application can communicate with the random quote service. We will learn about deploying to external servlet containers in Chapter 10. In normal development mode, we will use the hosted mode for testing, which runs the server code inside the embedded Tomcat servlet container in the GWT development shell. This makes it very easy to run and debug the server code from inside the same Eclipse environment as the client application code. This is another feature of GWT, which makes it an extremely productive environment for developing AJAX applications.

In the web mode, our client Java code has been compiled into JavaScript unlike in the hosted mode. Also, you will notice that the HelloGWT.gwt.xml is not in this directory. The configuration details from this module are included in the generated HTML and XML files above.

Thankfully, all this work is automatically done for us by the GWT framework when we run the HelloGWT-compile script. We can focus on the functionality provided by our AJAX applications and leave the browser-independent code generation and lower level XmlHttpRequest API to GWT.

We will learn how to deploy GWT applications to web servers and servlet containers in Chapter 10.

There's More!

You can also compile the HelloGWT application from the GWT development shell in hosted mode. Run the HelloGWT-shell command script to run the application in hosted mode. Click on the Compile/Browse button in the GWT development shell window. This will compile the application and launch the application in a separate web-browser window.

All this dynamic JavaScript magic means that when you try to view the source for the application from the web browser, you will always see the HTML from the host page. This can be disconcerting when you are trying to debug problems. But the fantastic Eclipse support in GWT means that you can debug issues from the comfort of a graphical debugger by setting breakpoints and stepping through the entire application one line at a time! We will learn more about debugging of GWT applications in Chapter 8.

Summary

In this chapter we generated a new GWT application using the provided helper scripts like applicationCreator. We then generated the Eclipse support files for the project. We also created a new random quote AJAX application. We saw how to run this new application in both the hosted and web modes.

In the next chapter, we are going to learn how to create GWT services that will enable us to provide asynchronous functionality that can be accessed via AJAX from the GWT application web pages.


User Comments

Comment by 'Joost' on 2007-05-08 12:15:58
It looked great when I started, but when I continued following this small course I noticed some information was missing. I can figure out myself how to add a stylesheet to an HTML page, but what line goes into the xml file is still a mystery.

Comment by GUEST on 2008-01-22 06:06:48
very usefull content to start with gwt.

Comment by GUEST on 2007-10-02 23:06:26
very usefull documenataion to start gwt
Your Name / Email Address
Comment
Spam Protection - Please enter the code in the image -

Listen to code




Add This Feed Button

Enter your Email


Java Expert Interviews
Pradeep Chopra Whizlabs
Certifying your way to success
TedLeungOpenSource
Why is open source so successful? Why should I contribute to open source?
EclipseExecutiveDirectorMikeMilinkovich
Eclipse is focused on closing in on Visual Studio - Switching campaigns are for marke
Processing...
Go to top of page  Home |
SiteMap

Copyright 2004 to 2008 Rightrix Solutions. All rights reserved. All product names are trademarks of their respective companies. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Rightrix Solutions and IndicThreads.com are independent of Sun Microsystems, Inc.

Views expressed at IndicThreads.com reflect the views of the authors alone, and do not necessarily reflect those of IndicThreads.com. IndicThreads.com and it's authors are not responsible for reader comments and opinions.

Enterprise Java J2EE JEE Portal >> IndicThreads.com