Unfortunately seam-pdf doesn’t play nice with ICEfaces. Specifically, the D2DFaceletViewHandler doesn’t do pdf/email rendering. The workaround for this is to separate the application into ICEFaces (ice: tags) and Non-ICEFaces (h: tags) pages which are the ones that trigger a pdf or email render. You can replace icefaces.jar with just-ice.jar, which contains renderers for ICEFaces components only. Then configure the application to delegate any pages that consist of a to the standard facelets view handler instead of D2DFaceletViewHandler.

Steps:

1. I updated to icefaces 1.8.1 and jboss-seam 2.2.0.GA and tested the application still functioned correctly.
2. Replace icefaces.jar with just-ice.jar (from the icefaces jars) and redeploy the application. You may get some errors. For example I found a number of errors caused because an xhtml page contained more than one with ids that weren’t unique.
3. If the application is functioning correctly you can start adding in the pdf functionality. Add itext.jar, itext-rtf.jar, jboss-seam-pdf.jar, jcommon.jar, and jfreechart.jar to your ear file.
4. In components.xml add the pdf and framework namespaces

xmlns:pdf="http://jboss.com/products/seam/pdf" xmlns:core="http://jboss.com/products/seam/core"
xmlns:framework="http://jboss.com/products/seam/framework"


http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
http://jboss.com/products/seam/pdf http://jboss.com/products/seam/pdf-2.1.xsd

Also add the following to configure missing pdfs:


true /pdfMissing.seam

5. In faces-config.xml you add both view handlers

com.sun.facelets.FaceletViewHandler



com.icesoft.faces.facelets.D2DSeamFaceletViewHandler

JSFoverride


6. Configure the document servlet in web.xml


Document Store Servlet
org.jboss.seam.document.DocumentStoreServlet



Document Store Servlet
*.pdf

and add a new mapping for jsf pages to be handled by the Faces Servlet



Faces Servlet
*.jsf


Your application should now be configured for icefaces pages, and non-icefaces pages that can render pdfs and emails. To test this you can copy some of the .xhtml pages from seam’s examplesitext to test that the pdf rendering works. The index.html lists the examples available. You will need to take lists.xhtml and Lists.java and add them to your application to test that the PDF Lists link in the index works correctly. Assuming your application has no errors and the PDF List example generates a pdf successfully, you’re ready to use seam pdf in your web application.

%d bloggers like this: