smtpUsername);
setValue("smtpPasswordEntry", data.smtpPassword);
setValue("fromAddressEntry", data.fromAddress);
currentView = "divOptions";
showView(currentView);
hidePleaseWait();
}
There really is not much to this. A call is made to the server, which returns the options,
and the response handler then populates the fields of the Options view with the data, which
can be seen in Figure 4-8.
Figure 4-8. The InstaMail Options screen
CHAPTER 4 n INSTAMAIL: AN AJAX-BASED WEBMAIL CLIENT 161
One thing I would like to bring to your attention is that the call to retrieveOptions()
returns an OptionsDTO, as we??™ll see when we look at the server-side code. Recall the dwr.xml
configuration file, in which we allowed DWR to convert the OptionsDTO. DWR is able to essentially
take that bean and convert it to a JavaScript object (that??™s effectively what happens
anyway, whether that??™s really what happens is a DWR detail we don??™t so much care about for
our purposes here). What is important, however, is that DWR is giving us the illusion of having
that OptionsDTO on the client and allowing us to access its fields via the data variable. This is
pretty cool! The cleanliness of the previous code in terms of actually accessing the options definitely
is.
Pages:
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314