Prev | Current Page 204 | Next

Frank Zammetti

"Practical DWR 2 Projects"


CHAPTER 3 n ADVANCED DWR 102
Figure 3-3. Anatomy of a DWR Ajax request
We can see the response just as easily with Firebug, and it??™s probably close to what you??™d
expect, as shown in Figure 3-4.
Figure 3-4. Anatomy of a DWR Ajax response
CHAPTER 3 n ADVANCED DWR 103
What??™s passed back is literally a JavaScript call to some DWR client code. This code will
then take care of calling the callback function you specified, after doing some of its own
housecleaning presumably. You can see how it passes the original parameters into that function,
as well as the result of the remote method invocation. You will also note some lines above
that, which are just JavaScript comments. These lines are pretty important, as we??™ll see shortly.
Before we look at that though, we may as well look at one more response from DWR, and
that??™s the case of a bean being passed back. Figure 3-5 shows just such a response.
Figure 3-5. An object being returned by a DWR Ajax request
This response was generated using a slightly modified version of the seconddwr application from Chapter 2.
All I did was add a getStudent() method to the StudentRegistry class that returned a populated
Student object.


Pages:
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216