Chapter 8. Demo Application

Phew, now we have plowed through a lot of the details dealing with the GWT development environment. What does our application involve? We'll keep it simple but real-world, not just your garden variety "Hello World" application. Figure 6 shows the screen for the application. The user clicks the "Request Info" button, and the three text fields are filled with the server name, the time of the user's request, and the associated user-agent string (a special identifier that is associated with each browser vendor).

Figure 8-1. The screen for our demo application in Firefox

Obviously, all this information is derived from a server componentin our case, a PHP file. We also have developed a Java servlet for the same purpose, which the shortcut will show in a later section.

The application user does not experience a browser refresh; the information appears in the text boxes after a few moments. Messages appear beneath the form widgets, letting the user know the status of her button click.

Figure 7 shows the screen after the user first clicks the button. An alert box shows the server return value (useful for debugging). A message in a large, green font indicates that the form values have been submitted. This message may seem obvious, but the user is accustomed to seeing the browser page refresh or reconstitute when she submits web form values. In Ajax applications, nothing happens upon this submission; the browser sends the data behind the scenes. Therefore, a message provides the user with a visual cue about the application's progress.

Figure 8-2. The user views HTTP request information in an Ajaxy manner

Figure 8 shows the final stage of handling the server return value, after the user has dismissed the alert window. The text boxes contain the server information.

Figure 8-3. Magic JSON provides information from the server

The message area displays a new message about JSON values being extracted. The server has returned its information in JSON format. The client side of the application extracts the data from this return value. An upcoming section about the application's source code explains this mechanism in more detail.

Now we will look at what is happening on the server side.

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 © 2008-2017.
If you may any questions please contact us: