473,545 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

run jrxml file with jsp

58 New Member
Hi All,

i have written a code to run jrxml file from jsp page...
but im not able to run the report
please check my code
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <%@ page language="java" import="java.util.*,java.sql.Connection,java.sql.ResultSet,java.sql.Statement" %>
  4. <%@ page import="java.sql.*,net.sf.jasperreports.view.JasperViewer,net.sf.jasperreports.engine.xml.JRXmlLoader,
  5.  net.sf.jasperreports.engine.JasperCompileManager,net.sf.jasperreports.engine.JasperFillManager,
  6.  net.sf.jasperreports.engine.JasperPrint,net.sf.jasperreports.engine.design.JasperDesign,
  7.  net.sf.jasperreports.engine.JasperReport"%>
  8. <%@ page import="com.systeam.ms.DbDetails,java.sql.DriverManager"%>
  9.  
  10.  
  11. <%!
  12. Connection con;
  13. ResultSet rs;
  14. String query;
  15. String ReportName;
  16. String path="Reports/";
  17. String ReportFile;
  18. %>
  19.  
  20. <%
  21.  //response.setContentType("application/pdf"); 
  22. try{
  23.  
  24. con=DbDetails.getConnection();
  25. query="select distinct FILENAME  from rpt_reportsform where 
  26. TITLE_LOC='Access Control Group/Forms'";
  27. rs=DbDetails.getRS(query,con);
  28.  
  29. while(rs.next())
  30. {
  31. //rs returns only single record here that is report1.jrxml
  32.  
  33. String ReportName = rs.getString("FILENAME");
  34. //here the ReportFile returns the string  Reports/report1.jrxml.
  35. concatination is needed since Reports folder contains report1.jrxml file
  36. ReportFile=path.concat(ReportName);
  37.     }
  38.  
  39. try{
  40.  
  41. JasperDesign jasperDesign = JRXmlLoader.load(ReportFile);
  42. JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
  43. JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null,con);
  44. System.out.println("run");
  45. JasperViewer.viewReport(jasperPrint);  
  46. //response.sendRedirect(ReportFile);
  47.       }
  48.       catch(Exception ex) {
  49.          String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage();
  50.          out.println(connectMsg);
  51.  
  52.    }
  53.  }}
  54. catch(Exception e)
  55. {
  56.     out.print(e);
  57. }  
  58.  
  59. %>
  60.  
  61.  
  62.  
im not able to run that jrxml file. control is going to catch block since it is not taking the specified jrxml file path.

my application structure is like this

MSReports
|
V
pages
WEB-INF
Reports
|
V
report1.jrxml
report2.jrxml


can anybody help me please
Jul 17 '07 #1
0 5537

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3911
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in...
5
5437
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. I want to develop a webpage where people can send attachments that are stored on their local PC.
7
3521
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. How do i make the last pointer in the indirect sector that has another level of indirect pointer, and be defined recursively to support infinite...
3
26247
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
3916
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header,...
13
4285
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I...
0
2372
by: shanmukhi | last post by:
hi All, i got a problem while running jrxml file from jsp page. i have written code to compile jrxml file, run the file and export to pdf. the code is running fine, pdf file is also generating...but pdf is not displaying while sending the request, it is not taking the path of pdf file... i have given exact path.....but it is not taking.......
1
13948
by: Akino877 | last post by:
Hello, If I have a .jrxml file, how do I compile it into a .jasper file? Could you please give a me instructions to do this? Thank you for your help. Akino.
1
9645
by: Sundhas | last post by:
Hey! I am working on jrxml to create dynamic re0ports. I have parameterized the columns i.e. the jrxml for that report can be used to generate other reports as well. However, i have not managed to make the fields flexible. That is, if the user selects 4 columns it would work but if 1 or 2 or 3 columns are selected, it gives an error since the...
0
7661
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7433
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7763
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5340
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
712
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.