JSP or Style Sheets?

There is some overlap between the features of Java Server Pages and XSL style sheets. You might be wondering how to decide which one to use.

XSL works best when you already have XML files, or when you generate an XML document as part of your normal processing. There are now applications that can query a database and return an XML document representing the data. XSL is ideal for formatting these documents.

JSP is better when you are working with pure Java objects, which is probably what you'll be using most of the time. Even if you read in XML data, if you do any processing on it, you'll likely be converting the XML into a Java object and then invoking methods on the Java object. If you have Java objects and want to use XSL ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.