Client-Side Presentation Logic
635
Make sure you use Netscape 6 or higher to access this. If you use Netscape 4 or IE 5, you will not get
the desired tabular display - these browsers do not support the table formatting features of CSS2.
CSS1 and CSS2 are very complex formatting standards, and an in-depth look at the technology
involved is out of the scope of this section. The interested reader is encouraged to delve into the
subject further at: http://developer.netscape.com.
Cross-Browser Solutions
After working through the formatting examples in this section, it should be evident to us that if we use
XSLT or the XML data islands to format our XML data for presentation, we would have to be sure that
all of our clients are using Internet Explorer browsers. On the other hand, if we use CSS1 or CSS2 for
formatting we should make sure that all of our clients are using Netscape browsers.
Of course, we can always duplicate our effort and support both, requiring users of different browsers to
use different URLs (or writing intelligent code that will detect the browser being used and re-directing
the URL). From this experience, we can safely draw one important conclusion:
In order to maintain some sanity in vendor and revision level compatibility as far as
browsers are concerned, a client-side XML processing solution using a Java applet is
BY FAR the technique of choice.
Limitation of the One-Shot Approach
It should also be evident that, while transformation and formatting of the XML data on the client side
using native browser support for XSLT or CSS1/CSS2 will reduce the load on the server, the amount
of data manipulation and filtering possible is rather limited. The page of XML data that is generated by
the JSP is a static snapshot of all the trips available at the moment of access. Use of XSLT and
CSS1/CSS2 only provides a direct mapping of the static data that the page consists of.
It is not possible, for example, to do what we did with the applet-based travel agency example and have
an optimized information update mechanism. If we were to use the one-shot approach with static data,
the user would have to refresh the page and download the complete list of available trips each and
every time. In order to perform intelligent filtering, extensive coding in the scripting language will need
to be created to access the object model provided with the browser.
In contrast to our Java applet-based solution, XSLT or CSS1/CSS2 formatting cannot:
q
Perform intelligent interactive filtering (for instance, filtering based on region or commission)
without extensive script programming
q
Perform optimized updates of the disconnected data set
Nevertheless, it is important for us to be familiar with these formatting techniques since there can be
scenarios where they can be used, alone or in conjunction with Java-based processing or script
programming, to solve design problems.