Jump to content
We've recently updated our Privacy Statement, available here ×

How do I serve the report dynamically online?


ktrinad

Recommended Posts

By: Issy Ramos - squaremonkey

How do I serve the report dynamically online?

2003-05-21 06:08

I have created a report from a mysql database, saved it as an XML file, and sucessfully compiled it as a PDF file. I would like to be able to post this report online so that users may be able to obtain this output, which changes throughout the day, dynamically.

 

I am using Apache and Tomcat on a Windows 2000 computer as the Web Server.

 

Any assistance would be greatly appreciated.

 

 

 

 

By: Issy Ramos - squaremonkey

RE: How do I serve the report dynamically online?

2003-05-23 13:44

I've downloaded JasperReports and find the documentation to be rather confusing.

 

Does anyone have a step by step method explaining how to get iReports, or JasperReports, to be served dynamically over a Web Server, running Apache and Tomcat?

 

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: How do I serve the report dynamically online?

2003-05-21 07:42

 

With JasperReports is shipped a good example on how to using JasperReports using servlets and JSP.

 

Giulio

 

 

 

 

 

 

By: rahulg2 - rahulg2

RE: How do I serve the report dynamically onl

2004-10-05 23:41

hi,

now the same problem i am having...

 

the example is good and working fine but there is no demonstration for directly connecting to the Database..through Connection string...

 

through iReport, Database connectivity is working fine..

 

but how to connect Manually inside Servlet??

in know this is a very elementry question, but for a NewBee its very frustating...

 

code for ref...

 

import datasource.*;

import net.sf.jasperreports.engine.*;

import net.sf.jasperreports.*;

 

import java.io.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

 

 

public class PdfServlet extends HttpServlet

{

public void service(

HttpServletRequest request,

HttpServletResponse response

) throws IOException, ServletException

{

ServletContext context = this.getServletConfig().getServletContext();

 

 

String driver = "com.mysql.jdbc.Driver";

String connectString = "jdbc:mysql://localhost/Practice";;

String user = "root";

String password = "";

 

Class.forName(driver);

Connection conn = DriverManager.getConnection(connectString, user, password);

return conn;

 

File reportFile = new File(context.getRealPath("/reports/ghi.jasper"));

 

Map parameters = new HashMap();

parameters.put("ReportTitle", "Address Report");

parameters.put("BaseDir", reportFile.getParentFile());

 

byte[] bytes = null;

 

try

{

bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

conn

);

}

catch (JRException e)

{

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<head>");

 

..............

..........

 

while compiling this file its giving errors...

 

cannot resolve symbols: Connection, DriverManager ...

 

help me..

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...