Getting Started
After downloading and installing GWT, make sure you are running a recent version of Java (Java 5 or higher is recommended; see the sidebar "Java 1.4 Versus Java 5"). Create a GWT project using your IDE or the projectCreator and applicationCreator programs supplied with the toolkit. Then select a web page where you want to insert the GWT component or application. This is known as the "host page" in GWT lingo. Listing One is the page we used in this article.
To inject the GWTFlow component into the page, we include our compiled JavaScript file (more on that later) and an HTML <div> placeholder element. Because GWTFlow needs to use special effects and support browser history, we also include a third-party JavaScript library and an <iframe> element. Listing Two is the resulting host page, with newly added elements in boldface.
<html> <head> <title>GWTFlow</title> <link rel="stylesheet" type="text/css" href="GWTFlow.css" /> </head> <body> <div id="header"> <div id="logo"> <a class="blind" href="GWTFlow.html">GWTFlow</a> </div> <p> <a class="tblind" href="about.html">About</a> <a class="tblind" href="contact.html">Contact</a> </p> </div> <div id="footer"> <p>Copyright 2007 Adam Houghton</p> </div> </body> </html>
<html> <head> <title>GWTFlow</title> <link rel="stylesheet" type="text/css" href="GWTFlow.css" /> <! Inject GWT code by including compiled JavaScript file > <script language='javascript' src='org.gwtflow.GWTFlow.nocache.js'></script> <! JavaScript we'll later need for effects > <script type="text/javascript" src="script/prototype.js"></script> <script type="text/javascript" src="script/effects.js"></script> </head> <body> <! IFrame for GWT history support > <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe> <div id="header"> <div id="logo"> <a class="blind" href="GWTFlow.html">GWTFlow</a> </div> <p> <a class="tblind" href="about.html">About</a> <a class="tblind" href="contact.html">Contact</a> </p> </div> <! GWTFlow will put its content in this div > <div id="main"></div> <div id="footer"> <p>Copyright 2007 Adam Houghton</p> </div> </body> </html>