Template languages based on ControlFlowAnalogies alone suffer from the weakness that the low-level control flow constructs used often obscure the intention of the specification of a complex page. The intention is most often to compose a page from several UI components analogous to widgets in a GUI.

Current page composition approaches (a MarkupCentric approach) also extend the vocabulary of a markup language by adding to its tags or attributes. However, the aim is to introduce constructs that allow a programmer to compose a page from a standard (often extensible) set of UI components. (Some of these languages also retain the more basic control flow level constructs.)

Java Server Pages (JSP) serves as an example, but this time using the newer tag libraries provided as part of Java Server Faces (JSF):

   1 <html>
   2   <head><title>Example</title></head>
   3   <body>
   4     <f:view>
   5       <h:form id='exampleForm'>
   6         <h:inputText 
   7                 id='message' 
   8                 value='#{MessageBean.message'/>
   9         <h:commandButton
  10                 id='changeMessage' 
  11                 action='success' 
  12                 value='Change'>
  13       </h:form>
  14     </f:view>
  15   </body>
  16 </html>

The f:view tag contains the specification of a whole window, composed of a form (h.form) which in turn contains a text input box (h:inputText) and a button (h:commandButton).

Although the example uses very simple widget components, more advanced components can be used that encapsulate logic usually coded with conditional and looping statements.

PageComposition (last edited 2006-04-20 11:51:34 by IwanVosloo)