The Hebrew University Magnes Press


 View book pages:
  




The flow looks very similar

by Joey Bernal, Peter Blinstrubas, Tim Hanis, Stefan Hepper, Ron Lynn, Cayce Marston, Usmon Memon, Varadarajan Ramamoorthy
The flow looks very similar to the AJAH calls but has an additional step at the end to really generate the markup ( step 5). As with AJAH, the first request renders the complete page, and subsequent interactions with the portlet generate XMLHttpRequest calls to retrieve XML data from a servlet. Now, the portlet needs to generate markup based on the XML data and insert that markup into the current browser DOM. The advantage of Ajax compared with AJAH is that the generation of the markup is offloaded from the server to the client. The drawback is that generating that markup is quite complex unless you’re using some additional framework, such as Dojo. ( For more details about Ajax and Ajax frameworks, see Chapter 14.) As in the AJAH case, using Ajax with portlets has the some limitations due to the fact that the markup must be served via a servlet. A typical use example for Ajax is paging through lists containing data retrieved from a database. ADOPTING PORTLET BEST PRACTICES Now that we’ve covered the basic patterns for portlet development and you’ve seen some real portlets coming into life, in this section we provide some best practices that will enable you to write more efficient, more maintainable, and higher- quality portlet code. Remember, though, that guidelines are always for the 90 percent case, and there are always exceptions where one of these rules may not apply. Therefore, use these best practices as rules of thumb rather than as something carved in stone. ADOPTING PORTLET BEST PRACTICES 103 Figure 4.7: Ajax request served by a servlet and rendered on the browser via JavaScript

Zoom in  zoom  Zoom out
  << Topic >>  | Contents | Index             |<   <<    Page       >>   >|  
The flow looks very similar to the AJAH calls but has an additional step at the end to really generate the markup ( step 5). As with AJAH, the first request renders the complete page, and subsequent interactions with the portlet generate XMLHttpRequest calls to retrieve XML data from a servlet. Now, the portlet needs to generate markup based on the XML data and insert that markup into the current browser DOM. The advantage of Ajax compared with AJAH is that the generation of the markup is offloaded from the server to the client. The drawback is that generating that markup is quite complex unless you’re using some additional framework, such as Dojo. ( For more details about Ajax and Ajax frameworks, see Chapter 14.) As in the AJAH case, using Ajax with portlets has the some limitations due to the fact that the markup must be served via a servlet. A typical use example for Ajax is paging through lists containing data retrieved from a database. ADOPTING PORTLET BEST PRACTICES Now that we’ve covered the basic patterns for portlet development and you’ve seen some real portlets coming into life, in this section we provide some best practices that will enable you to write more efficient, more maintainable, and higher- quality portlet code. Remember, though, that guidelines are always for the 90 percent case, and there are always exceptions where one of these rules may not apply. Therefore, use these best practices as rules of thumb rather than as something carved in stone. ADOPTING PORTLET BEST PRACTICES 103 Figure 4.7: Ajax request served by a servlet and rendered on the browser via JavaScript
Zoom in  zoom  Zoom out
  << Topic >>  | Contents | Index             |<   <<    Page       >>   >|  

MC Press Online - 978-1-931182-28-7


 Other related titles:
IBM WebSphere Portal PrimerIBM WebSphere Portal Primer
SOA for the Business DeveloperSOA for the Business Developer
You Want to Do What with PHP?You Want to Do What with PHP?

 Already viewed books:
Programming PortletsProgramming Portlets