Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

Templates, MVC, and XMLC

Let's be clear about one thing. XMLC was designed to deliver a pure templating strategy for Web presentations, not an interpretation of the MVC model. Heavily leveraging the Document Object Model standard and the intelligent use of a compiler-based strategy to simplify DOM programming, XMLC achieves complete isolation of Java logic from the markup language. That is what XMLC brings to the table.

This separation makes XMLC a true template mechanism. Illustrated in Figure 3.5, there is no logic in the template, and therefore the template becomes highly portable and can be manipulated by any number of Java objects that load it into memory. In XMLC, development the "controller" is the servlet that identifies the nature and requirements of the client device:

  • A Flash client that requires an XML stream

  • An HTML browser user that indicates she expects a page in German

  • An i-mode phone user with some graphics capability

Often in Enhydra programming methodology, presentation objects, sometimes sub-classed from an abstract "Base Presentation Object," process a request and load, manipulate, and return the DOM template that best suits the client and the nature of the request (for example, edit or browse).

XMLC has become an excellent strategy in a multi-device world. An application might support taxi drivers in the field as well as dispatchers back in the office. The taxi drivers use WAP phones, the dispatchers do not. Both, however, are required to log in.

Both users, the taxi drivers and dispatchers, access the application using the same URL. Checking the header information of the HTTP request, the servlet determines if the device is specific to WML or HTML. Depending on which is detected, the appropriate login screen is displayed. For the taxi driver, the screen is very simple in order to fit onto the small handset. For the dispatcher, it is larger, taking advantage of a standard browser's real estate to, perhaps, list the date and company banner.

Figure 3.5 Relationship of markup language and XMLC/JSP from the perspective of the HTML/XML designer.


XMLC will eventually provide support for the MVC model. But it will do so by supporting a new architecture, most likely in the form of colleague project Barracuda, which is being designed from the ground up to support XMLC, and potentially JSP, with a true component-based MVC model.

  • + Share This
  • 🔖 Save To Your Account