jQuery in Action, 2nd edition*
The moose likes Struts and the fly likes generate pdf and display on browser when clicked on link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "generate pdf and display on browser when clicked on link" Watch "generate pdf and display on browser when clicked on link" New topic
Author

generate pdf and display on browser when clicked on link

farheen rabiya
Greenhorn

Joined: Sep 28, 2009
Posts: 3
HI

Iam using struts 1.1 to generate a pdf report.
I have written the following code in my action class




And now when the user clicks on the link, pdf report should be generated in a new window.
which is what Iam not able to get.Iam getting errorr here.
Can someone help me what should be written in struts-config.xml file and what should be the url which on clicking should be giving the pdf.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Iam getting errorr here.

It'd be handy to state *what* error you're getting.

Window creation is handled by the browser, not the server. Are you opening the link in a new window? What's happening when you click the link?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9307
    
  17

farheen please Use Code Tags when you post a source code. You can edit your message using button and then add code tags to it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
farheen rabiya
Greenhorn

Joined: Sep 28, 2009
Posts: 3
Hi

@David
Iam getting "writer already obtained" errorr.
Iam using velocity template (front end) where my link is present.And on click of that link a pdf report should be generated in a new window.

@Ankit
Iam new to this site and so I dont know how this has to be done.

My problem is I cannot use execute method,even then,when Iam using execute method and returning null,its not working.
I dont understand what should the url be like?
Please help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: generate pdf and display on browser when clicked on link