Chapter 12. Classic Ajax and HTML forms

 

This chapter covers

  • Using RequestBuilder to communicate with the server
  • Parsing JSON and XML messages
  • Sending form data to the server using HtmlForm

In chapter 7 we introduced you to GWT-RPC, which is great for greenfield projects, but for most of us the baggage that comes with many projects constrains us. Project requirements sometimes make using GWT-RPC impossible. This chapter is about those times where GWT-RPC just won’t fit.

A good example of this incompatibility is when you don’t control the data, and in this age of mash-ups this is somewhat common. In this chapter the majority of our examples will use Google’s YouTube video data as a data source. This data is made available in several formats, and we’ll explore different ways to get this data into an application.

We’ll begin the chapter by looking at RequestBuilder, a tool that allows you to fetch a text file from your server and act on the returned contents. A related tool that we’ll look at is JsonpRequestBuilder, a tool that has the same job as RequestBuilder but is specific to working with JSONP[1] web services. If you haven’t heard of JSONP, it’s an acronym for JavaScript Object Notation with Padding, and this chapter will cover its use in detail.

1 Wikipedia maintains a good article on JSONP that you can find at http://en.wikipedia.org/wiki/JSONP.

12.1. Understanding the underlying technology

12.2. Using RequestBuilder

12.3. Posting data with RequestBuilder

12.4. Using the JSON API and JsonpRequestBuilder

12.5. Using JSON with JS overlay

12.6. Using the XML API and RequestBuilder

12.7. Using FormPanel

12.8. Summary

sitemap