|
Page 6 of 6
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.
|
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 |
|