|
Adding Mock-up Content
The final version of StockQuotes.html provides mock-up data by adding two TR elements to the stock table. The static Web page representation of StockQuotes.html is pictured below. The addition of mock-up content allows a realistic view of the Web page layout. This is particularly important since the static view is often created before the code to generate dynamic content has been developed.
| |
 |
Figure 3 | Example of StaticStockQuotes
|
<TR class="DummyData">
<TD>AABK</TD>
<TD>Aardvark Bricks</TD>
<TD ALIGN="right">$5.12</TD>
</TR>
<TR class="DummyData">
<TD>ABC</TD>
<TD>Another Bloated Company</TD>
<TD ALIGN="right">$12.82</TD>
</TR>
Note each table row is identified with the attribute class="DummyData". This designation facilitates removing the mock-up data before creating dynamic content. Again, since this functionality is so often needed, XMLC provides a convenient mechanism for removing mock-up data. The command to process StockQuotes.html
becomes
xmlc -delete-class DummyData StockQuotes.html
The command line argument '-delete-class DummyData' instructs XMLC to strip any DOM elements containing the attribute class="DummyData". Now here's the best part. To make the necessary changes to the Java code to accommodate the addition of mock-up data requires .... nothing. That's right, nothing. Because XMLC facilitates a clean separation between mark up code and the Java code used to generate dynamic content, there is no change to the Java code itself. This simple XMLC mechanism proves quite valuable in separating the concerns of Web designers from Java developers. The Web designer responsible for maintaining StockQuotes.hl is free to add and remove mock-up data, or to even move the various HTML elements around the page, all without affecting the Java development team's code. As long as the ID attributes are not altered, XMLC manages the link between the markup language code and the Java code. Furthermore, the Web designer deals with a file containing only familiar HTML markup and needn't carefully navigate around unfamiliar Java code or JSP tags.
As you can see, XMLC is a great technology for adding dynamic content to Web pages. There is, of course, much more to XMLC, and I encourage you to give it a spin on your next Web-based application.
Wm. Paul Rogers is an application architect with Lutris Technologies who has written for a number of technical publications, including Java World, Java Report and IEEE Software magazines. He is based in Carmel, Calif.
|