Browse DevX
Sign up for e-mail newsletters from DevX


Supercharge Your Java Web Applications with Translets : Page 4

Translets, a brand new addition to Java, can improve your Web application performance multiple fold. This article walks through the creation of translets, discusses translet functionality, and demonstrates how to use them from within a Java application.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Run the Application
Now it's time to run the sample application and generate a HTML page. Compiling the XSL files is simple and straightforward. However, you start your Java Virtual Machine in a slightly different way when you run the application. You need to specify the virtual machine at boot time to use the latest implementation of xercesImpl.jar, xalan.jar, and xml-apis.jar. You can accomplish this by using the following command:

>java -Xbootclasspath/p:/<lib_location>\xalan.jar;<lib_location>\xercesImp.jar;
<lib_location>\xml-apis.jar XSLTranformer example.xml example

This will ensure that the Java Virtual Machine uses these jars instead of the ones that Sun supplies with Java runtime environment.

If you want to use the translets in your servlets or JSP pages, make sure to use the '-Xbootclasspath' option in your Web server startup script.

Supercharge Your Web Apps
The sample employee application demonstrates how simple using translets to do XSL transformation is. Along with the benefits of XSL, translets improve your application's performance and provide greater flexibility for configuring and deploying your XSL files. Once you master this new technology, you can apply translets and supercharge your Java Web applications.

Raghu Donepudi is a senior software developer for Global Computer Enterprises. He is a Sun-certified Java developer and the author of many software design techniques. .
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date