Hello all,
I'm relatively new to SEAM and was experiencing a problem using the iText library. I
was able to successfully get a PDF to render by putting the pdf (p:XXXX) code directly
inline into my .xhtml page. I wanted this to work by generating links and allowing the
user to download the PDF.
Looking at the docs this is what I did.
In my web.xml, I added:
<filter-name>Seam Servlet Filter</filter-name>
<filter-class>
org.jboss.seam.servlet.SeamServletFilter
</filter-class>
<filter-mapping>
<filter-name>Seam Servlet Filter</filter-name>
<url-pattern>*.pdf</url-pattern>
</filter-mapping>
<servlet-name>Document Store Servlet</servlet-name>
<servlet-class>
org.jboss.seam.pdf.DocumentStoreServlet
</servlet-class>
<servlet-mapping>
<servlet-name>Document Store Servlet</servlet-name>
<url-pattern>*.pdf</url-pattern>
</servlet-mapping>
In components.xml, I added:
<pdf:documentStore useExtensions="true" />
In my .xhtml page, I places a link as such:
<s:link id="agent-pdf"
view="/agent-pdf.xhtml">PDF</s:link>
I created an agent-pdf.xhtml page as such:
<p:document
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:p="http://jboss.com/products/seam/pdf"
xmlns:h="http://java.sun.com/jsf/html">
<f:facet name="header">
<p:font size="12">
<p:footer borderWidthTop="1" borderColorTop="blue"
borderWidthBottom="0" alignment="center">Why Seam?
[<p:pageNumber />]</p:footer>
</p:font>
</f:facet>
<p:paragraph spacingAfter="200" />
<p:font size="24"><p:paragraph spacingBefore="100"
alignment="center">Ten Good Reasons To Use
Seam</p:paragraph></p:font>
<p:image alignment="center" value="#{agent.photo.data}"
/>
<p:chapter number="1">
<p:title>
<p:font size="18"><p:paragraph>It's the quickest way
to get "rich"</p:paragraph></p:font>
</p:title>
<p:paragraph alignment="justify" spacingBefore="5">AJAX
fundamentally changes the interaction model of the web. The synchronous, coarse-grained
requests used by traditional web clients let many server-side applications get away with
minimal caching and no session-level concurrency. The "stateless" architecture
is in many cases a viable solution. But not anymore! AJAX clients hit the server with many
asynchronous, concurrent, fine-grained requests, which could easily bring your database to
its knees. When state is held in memory between requests, it is highly vulnerable to
concurrency-related bugs, since the Java EE platform provides no constructs for dealing
with session-level concurrency.</p:paragraph>
<p:paragraph alignment="justify"
spacingBefore="5">Seam's totally unique concurrency model and
state-management model was conceived and designed with AJAX in mind. </p:paragraph>
<p:paragraph alignment="justify" spacingBefore="5">Seam
1.1 integrates open source JSF-based AJAX solutions like ICEfaces and Ajax4JSF with
Seam's state and concurrency management engine. You can add AJAX to your applications
with ease, without the need to learn JavaScript, and you will be protected from potential
bugs and performance problems associated with the switch to AJAX. </p:paragraph>
</p:chapter>
<p:chapter number="2">
<p:title>
<p:font size="18"><p:paragraph>It's the easiest way
to get started with EJB 3.0 </p:paragraph></p:font>
</p:title>
<p:paragraph alignment="justify" spacingBefore="5">EJB
3.0 is a great component model for transactional business components, the highlight being
the brand new Java Persistence API (JPA). But Java web and application frameworks designed
before the release of EJB 3.0 lack support for the new component model, leaving you to
write your own integration code, and in many cases forcing you into the use of a layered
architecture that may not be right for your application. </p:paragraph>
<p:paragraph alignment="justify" spacingBefore="5">Seam
was designed for use with EJB 3.0 and lets you use the new component model everywhere.
Since any class in a Seam application can be an EJB component, there is no need to
introduce extra unwanted layers just to keep your frameworks happy. And, of course, there
is no need to write code to integrate EJB 3.0 with your web framework, since Seam already
has it. </p:paragraph>
<p:paragraph alignment="justify" spacingBefore="5">Note
that you don't have to use EJB 3.0 to use Seam, and if you're developing in an
environment that doesn't support EJB 3.0, Seam provides alternatives.
</p:paragraph>
</p:chapter>
</p:document>
The page doesn't throw an error but only shows a blank page. Anyway help would be
greatly appreciated. Hopefully I'm on the right track.
W
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079202#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...