Section 8.2. HTML File


8.2. HTML File

I made quite a few small changes to the HTML file that applicationCreator automatically generated. This is mainly because, as in many real-world applications, the HTML should be valid against a certain markup type. I changed the HTML so that the markup conforms to XHTML Transitional. I used the World Wide Web Consortium's markup validation service to check the file: http://validator.w3.org.

Here is the XHTML file's source code.

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"       "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang=       "en" lang="en"> <head>   <meta http-equiv="content-type" content=           "text/html; charset=UTF-8" />   <link rel="stylesheet" type="text/css" href="gwttest.css" />   <title>Request Info</title>   <!--                                           -->   <!-- The module reference below is the link    -->   <!-- between html and your Web Toolkit module  -->   <!--                                           -->   <meta name='gwt:module' content=           'com.parkerriver.gwt.intro.GwtAjax' /> </head> <body> <!--                                            --> <!-- This script is required bootstrap stuff.   --> <!-- You can put it in the HEAD, but startup    --> <!-- is slightly faster if you include it here. --> <!--                                            --> <script type="text/javascript" language=       "javascript" src="/books/4/246/1/html/2/gwt.js"></script> <!-- OPTIONAL: include this if you want history support             <iframe  style="width:0;height:0;border:0"></iframe> --> <h2>Send a Request; Receive Info</h2> <!The form will dynamically be generated inside this div --> <div ></div> <!This div contains the status messages--> <div ></div> <!This div displays any error messages--> <div ></div> </body> </html> 

The changes I made in the HTML included the DOCTYPE at the top; the addition of a "type="text/javascript"" attribute to the script tag, properly closing the meta tags, and the like. The HTML file includes div tags at the bottom. The JavaScript that the GWT generates for this application, from the Java source in GwtAjax.java, will dynamically write the form tags and any messages inside these tags, as well as handle the button-click event.

One div will contain the form elements, and the next two divs will contain informational and any error messages.

Now we can finally look at the Java source for our client.




Google Web Toolkit for Ajax
Google Web Toolkit GWT Java AJAX Programming: A step-by-step to Google Web Toolkit for creating Ajax applications fast
ISBN: 1847191002
EAN: 2147483647
Year: 2006
Pages: 29

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net