Prev | Current Page 113 | Next

Frank Zammetti

"Practical DWR 2 Projects"


Consider the situation if you have a collection of classes with some functions in each that
you wish to be callable from JavaScript. Let??™s ignore the question of how mechanically you??™re
going to make those calls and just think about what the server-side code would have to look
like. Each function would have to be exposed as essentially a service endpoint, and this would
likely mean a servlet for each (forgetting about any application framework for just a moment).
Sure, you will likely be smart about it and only have a single servlet involved, but considering
that the URI you use to address a given function would necessarily have to be unique,
even if it only differed in some parameter you pass in, you can quickly see where this might
become a hassle in a hurry. The other important consideration is the protocol you use to make
the call. How do you pass parameters to the remote function? How do you marshal the return
value(s) into a formyou can use in your JavaScript? These are the kinds of details you??™ll have to
deal with yourself, and that??™s just a taste of what would be involved. (What about error handling?
What about security? Argh, the list grows in a hurry, doesn??™t it?)
DWR releases you from these burdens by taking care of all these details for you.


Pages:
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125