设为首页】 【加入收藏】 【网站地图】 【商品折扣
娱乐一生 娱乐明星
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
首页  |  java  |  .NET  |  C/C++  |  网页技术  |  php  |  asp  |  delphi  |  VC  |  VB开发  |  游戏开发  |  软件工程  |  Power Builder  |  Linux开发  |  Windows开发技巧
当前位置:首页 >> JAVA与XML >> Publishing XML Documents in PDF and HTML with Cocoon

Publishing XML Documents in PDF and HTML with Cocoon -

his article shows you how to publish XML documents in PDF using Apache Cocoon. Cocoon can create result documents in a variety of formats, including HTML and PDF. Cocoon's popularity reflects that of the Adobe's PDF format, which most vendors prefer for e-mailing richly formatted printable documents and reports. Cocoon converts not only text content, but also graphs and images. This article focuses on using Cocoon to dynamically generate HTML and PDF.

Although there are alternatives for generating PDF, Cocoon is preferred because it provides various value-added features. For example, the Cocoon site says: "Cocoon interacts with many data sources, including file systems, RDBMS, LDAP, native XML databases, SAP systems, and network-based data sources. It adapts content delivery to the capabilities of different devices like HTML, WML, PDF, SVG, and RTF, to name just a few. You can run Cocoon as a Servlet as well as through a powerful, command line interface. The deliberate design of its abstract environment gives you the freedom to extend its functionality to meet your special needs in a highly modular fashion." You can find a complete feature list at http://cocoon.apache.org/2.1/features.html.

What You Need To gain the greatest benefit from this article, you should be somewhat familiar with XML/XSL and J2EE. You can use any Java Web application server; I used the JBoss 3.2.1 server to test the article code.
Follow these steps to get started:

  1. Download Cocoon 2.15
  2. Build and install Cocoon
  3. Create or download the source code files to build the examples in this article (the XML, XMAP, XSL, and JSP files)
  4. Test the application
The rest of this article describes how to perform each of the steps in more detail.

Download the Cocoon Source
To get Cocoon and configure it for your server, first download the latest version from http://Cocoon.apache.org/2.1/index.html.

Building Cocoon
The following procedure lists the steps to build and deploy Cocoon.

  1. Execute build (default target)—just type build on the command prompt in the directory where you installed Cocoon (by default that's C:\Java\Cocoon-2.1.5.
  2.   Figure 1. The Cocoon Welcome Page: After building and installing Cocoon as described in this article, you should see this page by browsing to the default Welcome page (http://localhost:8080/cocoon/).
  3. Next, build the war file using the command build war.
Author's note: These are separate commands. Perform both build, and build war.
  1. Deploy the Cocoon Web application war file by copying the Cocoon.war file generated by the build process in step 2 from \Cocoon-2.1.5\build\Cocoon-2.1.5\Cocoon.war to the default\deploy directory. When you complete these steps Cocoon should be up and running on JBoss.
  2. Test your Cocoon installation by starting the JBoss server and go to http://localhost:8080/cocoon/. If the installation succeeded, you'll see the screen shown in Figure 1.
Author's Note: The information in this article assumes that you're running your local HTTP server on port 8080.



 

娱乐图摘

更多 >>

靓丽清纯美女meimei

美女私房全裸照
导演劝女演员脱衣服(视频)

大胆火辣人体艺术写真(图)

黑丝妹妹热辣诱惑-丝袜美女妹妹

PLMM 漂亮妹妹图集-妹妹图库

全球美女图库-美女集中营

52MM 我爱漂亮妹妹-制服妹妹诱惑

图王图库-世界美女明星图片资料库
美女写真集锦

激情两性-解密性生活
浴室MM湿身内衣诱惑
邻家小妹洗澡被偷拍(视频)

热点文章

更多

· Eclipse Plugins Exposed, Part
· Enterprise Web Services Securi
· Portlets and Portals Design Ov
· 实现电子商务的可伸缩性和高可用性--BEA WebLogic
· Getting the Most from the MX C
· XML DTD for EJB Deployment Des
· A Dozen Ways to Get the Testi
· XQuery Not Necessarily the Dea
· AXIS学习笔记(一)
· Java程序文件格式设计

热点文章

更多