|
|
Ajax for Java developers: Java object serialization for Ajax
|
10/04/2005, By Philip McCarthy
|
Most Java developers have applied the Model-View-Controller (MVC) pattern to their Web applications. In a traditional Web application, the view component is composed of JSPs, or perhaps another presentation technology such as Velocity templates. These presentation components update the user interface by dynamically producing a whole new page of HTML to replace what the user was previously looking at. In the case of a Java Web application with an Ajax UI, however, the JavaScript client code has ultimate responsibility for updating what the user sees, based on data received in response to an XMLHttpRequest. From the perspective of the server, the view becomes the data representation it sends in response to client requests.
This article focuses on the techniques you can use to generate data-centric views of your Java objects. I'll demonstrate a variety of methods you can use to turn your JavaBeans into XML documents, and you'll learn the pros and cons of each. You'll also see why XML is not always the way to go: transferring plain text can be an expedient choice for simple Ajax requests. Finally, I'll introduce you to JavaScript Object Notation (JSON). JSON allows data to be transmitted in the form of serialized JavaScript object graphs that are extremely easy to work with in client-side code.
Read more...
|
Rate this Ajax Articles
Rating: 0.0 out of votes cast
| |
|
|
|
|
|
|
|
|
|
|
|
|