The book (Ajax Patterns and Best Practices) by Christian Gross is a welcome sign as it deals with patterns, patterns to be used for Ajax based applications, and not just the procedure calls and technicalities of the Ajax API.
Assuming that we have a web app developed using ajax technology then does that mean that we have just load page in browser(User Interface) and make all requests to the server using ajax. If yes then that would mean that when we need to show another page(options) we will need to hide old elements and display new ones. Because we would make a call to the server, maybe to search for books, and when we get the results, we display the results and hide the search options, and when the user selects a book, make another ajax request to get the book details and then hide the search results and display the book info. This can be done using layers, but if we use something like this for a larger application then wouldn't the User Interface for the web application be just one big file(JSP or otherwise) and wouldn't it get very very complicated?
How would you suggest we tackle such a scenario, or rather how should Ajax be used?
The question is does this result in one big file (JSP, etc) that contains everything?
Here is how I would do it. Following is the URL to load the main content.
The variable menu is an incomplete type because when the original main resource is downloaded there is no definition for menu. To make menu complete the /main/menu chunk is downloaded, and executed. Contained within the menu.create() is the logic to create the menu.
Using incomplete types is identical to Java components in that menu.create is the interface, and the resource /main/menu is the implementation. Using this approach allows you to modularize an Ajax application and distribute logic among individual resources. For example, when the call /main/menu is made the server could implement need to know security as the server has the ability to choose the implementation at runtime.
Does this help?
Author of Ajax Patterns and Best Practices
Joined: Nov 16, 2005
Firstly, thanx for answering the question, it definitely helps. While waiting for a reply I went through the other threads(It must be Fate etc.) and read Ur suggestions there, it all makes sense now.
Best of Luck with Ur book!
Ali [ February 21, 2006: Message edited by: Liyaquat Ali ]
Joined: Feb 20, 2006