This article gives you a way to integrate Ajax into your portal application. Because there are several articles that have a general introduction to Ajax, let's assume you understand the basics of Ajax; That is, you already know what Ajax is, the origin of its name, it's not a new technology, and Google How to bring this technology into the mindset of every manager and technical expert in the world. Our goal is to provide you with useful information that is relevant to using Ajax in a portal application, so when people in the CTO's office ask your portal application if AJAX is enabled, you can confidently say: "Of course!" ”。
So, if you've decided to introduce Ajax into the portal, the content of this article is well worth your attention. Although this article focuses on the portal applications, these techniques are generally useful for most complex applications. This article also prepares you for a follow-up tutorial, in which we will detail the creation of Ajax Portlet applications.
Why should Ajax and WebSphere Portal work well together?
One of the most expensive operations in the portal environment is refreshing the page. When a user clicks a link on a page or does something else, the portal processes the Actionperformed () method of the target Portlet on the page and the Doview () method for each portlet. The results are then aggregated and the entire HTML document is sent down to the browser.
Although caching can reduce a lot of overhead, there are many other problems. You can use Ajax to handle many user interaction events in the background, and then update parts of the page without the full portal refresh cycle. This technology greatly improves the end-user experience by increasing the response to a single operation, while also significantly improving the overall performance of the application. In some environments, using Ajax can make your application's overall architecture clearer. Using a level two Ajax controller, such as a Servlet or Web service, allows for more robust model code separation.
When you apply the entire AJAX controller design to your application, you should use an AJAX controller to handle all basic user input operations and segmented display updates. The portal actionperformed () method is used only for page-level conversions or for handling major state changes.
Why can't Ajax and WebSphere Portal work well together?
So why don't you want to use this new paradigm in your rich Internet application? All technical weeklies think this is a good way, and your boss informs you to use it because it is "one of the business goals." Of course, we won't ask you not to use it, but I do want you to know some potential flaws:
Using multiple controllers, such as Portlets, Servlet, and Web services, increases the complexity of your application.
Use Ajax to force clients to handle many logic.
Your application may not need to make additional data updates between page transitions.
To sum up, you may determine that Ajax is not for you and that you need to read other articles. Wait a minute, it's just a joke. Friends, please continue to read! Ajax is so cool that you would be sorry if you didn't add it to your application.
At least you should accept it slowly. Find an application that can use a little trick and add the beauty of Ajax to your user form or wizard. Once you get started and understand that a little bit of effort can be made to gain some effective user enhancements, you're sure to be ready to actually add some fantastic ways to your portal application.
After adding Ajax to the portal application, you can effectively add multiple controllers to the classic MVC pattern. This decision has potential benefits for a clear separation of the enforcement model logic. The disadvantage is that it adds complexity and inevitably divides the controller into the following three sections:
Servlet or Web service