473,749 Members | 2,432 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 5556

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

Similar topics

2
3929
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 displaying them on the delete page. you can see it in action at www.4am.com.au/gallery/upload.php...
5
5467
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
3536
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 large files? -code-
3
26267
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
3939
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, example, and DLL:...
13
4319
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 cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
0
2392
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.... i tried in somany ways but no use....... please help me..i need it urgent. here is my code of jsp
1
13957
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
9671
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 field names are unidentified. Please post a solution urgently if something like a default...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6801
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.