Java 2EE and XML Development

Скачать в pdf «Java 2EE and XML Development»


</wml>


Listing 5.7 The British English WML watch list JSP


<jsp:useBean name=»helper» scope=»page»


class=»examples.chapter5.XMLHelperBean»/>


<%@ taglib uri=»example.tld» prefix=»helperTag» %>


<wml>


<card id=»main» title=»Your Watch List»>


<do type=»accept» name=»do-back» label=»Back»>


<go href=»http://www.exampleco.com/home.wml» />


</do>


<do type=»accept» name=»do-buy» label=»Buy Shares»>


<go href=»http://www.exampleco.com/buyShares» /> </do>


<do type=»accept» name=»do-sell» label=»Sell Shares»> <go href=»http://www.exampleco.com/sellShares» /> </do>


<p><b>Greetings, Mr.


<jsp:getProperty name=»helper» property=»lastName»/>! </b></p>


<p>Here are the latest prices on your stocks of interest.</p> <table columns=»3″>


<helperTag:printData useLinks=»no» currency=»GBP»/>


</table>


</card>


</wml>

5.2.4    Analyzing the results


We think you will admit that building a multidevice, multilocale presentation layer in J2EE is not easy. Imagine how much worse things could have been if we had chosen some less-complimentary output formats or wildly different locales. Also consider how much effort would be involved in extending our example code to accommodate more languages, locales, or device types.


This is the area in which an XML-based presentation layer can come to the rescue to some extent. While serving substantially different views of the same application is always challenging, some XML tools have recently emerged to make the process a bit easier for you. That is, after you learn to use them.

5.3    The J2EE/XML approach


The first XML architectural alternative we examine involves the combined use of XSLT with the J2EE presentation comp
onents. In chapter 2, we talked briefly about what XSLT is and how to use it via JAXP. You will recall that XSLT provides a general way to transform XML into virtually any output format. This comes in very handy when generating thin-client user interfaces like the one we have been working with in our example.

Скачать в pdf «Java 2EE and XML Development»