|
|
produce dynamic Web pages with Java and XSLT |
|
|
produce dynamic Web pages with Java and XSLT |
|
|
XML / Java and XML |
|
|
Click to Visit |
|
|
16 |
Earlier XML, developers had to produce dynamic Web pages with some sort of server-side scripting technology, such as CGI, Java servlets, or JSP. In the pre-XML model, a built-in API makes the user-request parameters available; the server-side script then generates dynamic content and sends it back to the browser. That's still probably the best programming model for applications that need real-time access to data stored in a database. In this new model, you create XML documents from the data stored in your databases at some regular interval. Then you serve the XML documents directly to clients. For Web browser clients, you transform XML to XHTML via XSLT style sheets. It gets really interesting when you have to use only one style sheet to create different XHTML pages based on the user input. I'll show you how to implement this technique. This article discusses two ways to produce dynamic Web pages with Java and XSLT by passing user-request parameters from a Java backend program to an XSLT style sheet used to render the Web page. The sample code demonstrates the use of the XSLTProcessor method and a custom method, plus how to use global parameters in XPath expressions.
|