• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display a dynamically generated PDF in a new browser using Struts?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scenario: The user selects a Reference no and then clicks button in a jsp. After that, a new window should open up and a dynamically generated PDF should be displayed there.

Problem: -- When I run this as a java application, the PDF file is generated fine. But I am new on Struts. and am not sure of the flow for calling and displaying this servlet.

What I have tried to do: -- In the jsp after the user clicks on the button, I pass the following URL while opening another window.
eg. var mononeyURL = "http://localhost:9080/pcnavms/monroney.do";
openResourceWindow((mononeyURL) , 600, 800, true, true, true, false);

This opens up the new window fine. And in the monroney jsp, I am trying to intantiate the class
eg. monroney.jsp
<%@ page language="java" contentType="application/pdf fullscreen=yes"%>
<% controller.checkPDF.CreatePOVMonroney al = new controller.checkPDF.CreatePOVMonroney();
al.processRequest(request, response);
%>

and in the struts.config file I have declared the following :
<global-forwards>
<forward name="monroney" path="/WEB-INF/jsp/dlrTnRcv/monroney.jsp" />
</global-forwards>

<action-mappings>
<action path="/monroney"
type="controller.dlrTnRcv.MonroneyAction"
name="commonForm"
scope="request"
input="/WEB-INF/jsp/dlrTnRcv/monroney.jsp"
validate="false">
</action>
</action-mappings>

But this doesn't work. Can anyone please help me with this.

thanks,
Paromita
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to help you, we need you to be more specific than "doesn't work". Tell us what's happening that shouldn't or what isn't happening that should, including error messages, stack traces, etc.
[ August 11, 2006: Message edited by: Merrill Higginson ]
 
paromitabanerjee mukerjibanerjee
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens is, it opens up a new window. The File Download Box is displayed.(Save monroney.do) If I click on Save it save a file named monroney.do which has got nothing in it. If I click cancel, then nothing happens. And the new window, anyway disappears.

thanks,
Paromita
 
paromitabanerjee mukerjibanerjee
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am trying here, is generating a PDF file(whose data is dynamically populated) which should be displayed in the new window that has opened (not save it to hard disk).

I can't understand why monroney.do is created as a file and asks for saving it.
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic