My application is based on AppFuse 1.9.3 with WebWork I am trying to add
a printOffer action that uses iText to render PDF. I have tried a couple
of different approaches, but when the action is called by selecting an item
from the offerList, I just get a vague error:
javax.servlet.ServletException: Could not execute action
at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(
DispatcherUtils.java:246)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(
FilterDispatcher.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:202)
My printOfferAction sets the type and returns PDF data in the response
OutputStream, but I'm not sure what else needs to be configured.
My current entry xwork.xml looks like this:
<action name="printOffer" class="printOfferAction" >
<result name="success" type="stream">
<param name="contentType">application/pdf</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">filename="coupon.pdf"</param>
<param name="bufferSize">1024</param>
</result>
</action>
Alternatively, I also tried an approach similar to that described in the
POJOtoPDF wiki tutorial
<display:column sort="false" media="html">
<c:url value="/print" var="printOffer">
<c:param name="userName" value="${users.username}"/>
</c:url>
<a href="<c:out value='${printOffer}'/>">
PDF
</a>
</display:column>
This just blows up my offerList.jsp and won't even render.
My real question is this: How would I accomplish this if I actually knew
what I was doing?
-Bron