This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
My question is that, in my application there is some data which can be converted into pdf,xml and doc format? What do you reccomend that either i use xsl/xslt and xsl-fo or use third party tools for converting the data into desire format?and could i use crystal report for this purpose? Please give me the best practices for generating different format files for client using jsp/servlets thanks and best regards. Faisal Ishaque
Yes. If you want PDF's and they aren't difficult reports, I'd check out IText for creating them. It has Java Classes for creating PDFs. If you want to transform your XML into HTML, use XSLT. I don't know much about Crystal Reports class, but We use Crystal with our VB applications and it is handy. Mark
If you use a cache to store pre-compiled XSL documents performance decrease is negligable (especially seen in the light of the typical runtime of a medium sized JSP or servlet, throw in some EJB calls and you will never even notice) after the first request that adds the compiled XSL to the cache. I've successfully used code like the following (this is a rough draft of a version I'm working for for an upcoming new project):
as the doPost method of a servlet. 'cache' is a simple HashMap that's declared static to the servlet. Calling entities pass a Document object and the name of an XSL stylesheet (which are assumed to be stored in /WEB-INF/xsl here). Using similar code written for an earlier version of Xalan I clocked transformation times of 2-5 milliseconds for quite complex XSL stylesheets (with compilation taking 300 or so milliseconds, illustrating the need for caching). About half this code is actually concerned with errorchecking, using an HTML template to generate an HTML output to display errors on the fly. [ December 01, 2003: Message edited by: Jeroen Wenting ]
Hi faisal, if you want to include the Model-View-Controller pattern in your application design check out StrutsCX to generate your XML or PDF output. StrutsCX is an extension to the Apache Struts framework for use with XSLT - as alternative to JSP. It includes Apache's FOP. http://it.cappuccinonet.com/strutscx Regards, Bernhard Woehrlin