How to print a crystal report using JSP?

Could anybody tell me how to print a crystal report from a JSP. I use Seagate Crystal Reports. Any advices or sample codes will be highly appreciated.
[165 byte] By [huangjjing] at [2007-9-26 4:04:25]
# 1

For starters, you're going to need a few servers set up.

1) A Web Server (Apache, IIS, etc.)

2) A JSP Server (Tomcat, Jrun, etc.)

3) Seagate Page Server

4) Seagate Web Component Server

5) A Database Server (optional)

Let me know your current setup and we can go from there.Also let me know which operating system each server is on and which version of Crystal you are working with.

-- Chris

carrich1 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for your response, Chris.

Our web server is IIS. JSP server is New Atlanta ServletExec. They are runing on Windows NT. The database is Oracle 8. We use Seagate Crystal Reports Version 8. I am not farmilar with the servers set up stuffs. But our system amdinistrator has already set all servers up and they are ready for use.

What I need to do is to print a report called Oeepm.rpt, which is stored in a subfolder under the crystal reports server. The path for the report is like this: http://someURL/wwwroot/CrystalReports/Oeepm.rpt?init=java.

There is a button called Print Report on my current interface. When users clicks this button, there will be a window called Crystal Report Viewer pomping up. Meantime, the search resultset from the database should be passed to the report and then users can use the print button on the viewer to accomplish the print requirements.

My problem is: How to call a crystal report through JSP? And how to put the values I get from the database into corresponding fields on a formatted report. Is there any way to solve the problems by only using JSP? Or I have to use applet.

Please help me out, Chris. I feel that you are an expert here. Many thanks again.

huangjjing at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hopefully, this topic is still being watched.

It looks all of your servers are set up fine. So let's assume you have created this report "Oeepm.rpt" in the virtual directory "http://someURL/wwwroot/CrystalReports/".You have specified that you would like to use the report viewer written in Java.So your hyperlink to the report is "http://someURL/wwwroot/CrystalReports/Oeepm.rpt?init=java" as you have specified.

Your next step is to make the report dynamic. I am going to assume that you do not want to use the query builder in Crystal, and that all of your queries will be connected through ODBC directly to a database table, view or stored proc. You have to decide if the users will pass parameters into the report or if the report will run the same query each time.

First, let's assume that you want to run the same report query each time. If this is the case, then you're half way done. You need to setup an ODBC connection on your server which contains the Crystal Reports. The connection will supply the database connection parameters to your Oracle database. For ease of development, you can write the ID and Password into the ODBC connection so that you do not have to pass them in from the JSP. Then open up the Oeepm.rpt via Crystal and do the following:

1) Click on File Menu Option and make sure that "Save Data with Report" is not checked.

2) Click on the Database Menu Option and set your location up so that it goes through your ODBC connection and connects to either a Stored Procedure, Table or View.

3) Add this into you JSP page: <A HREF="http://someURL/wwwroot/CrystalReports/Oeepm.rpt?init=java" >Web Report</A>

That should really be it.

Second, let's assume you want you're users to pass parameters into your report. If this is the case, follow steps 1 and 2 above but make sure you select a Stored Procedure in step 2. The Stored Procedure must be created so that it accepts parameters. We'll assume you set it up to accept two parameters.

Then set your JSP with the following code: <A HREF="http://someURL/wwwroot/CrystalReports/Oeepm.rpt?init=java&prompt0=<%=request.getParameter("firstHtmlFormParameter")%>&prompt1=<%=request.getParameter("secondHtmlFormParamter")%>" >Web Report</A>

The values firstHtmlFormParameter and secondHtmlFormParameter must be the name of the fields in your html form. The form action should be the name of the JSP which contains all of this code.

I know that this is a confusing mouthful so if you run into any problems, just let me know.

-- Chris

carrich1 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi all,

I also face similar problem. I would like to call Crystal Reports in JSP. I can handle it well now. But I hope to let user input their selection criteria before printing out the report. I know how to get the parameter value in JSP, but I really dunno how to pass these parameter values into the SQL statement in Crystal Report. Actually, is it possible to do so?

If anyone has idea, please tell me. Thx Thx!

Regards,

Betty

sillybetty at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

> For starters, you're going to need a few servers set

> up.

>

> 1) A Web Server (Apache, IIS, etc.)

> 2) A JSP Server (Tomcat, Jrun, etc.)

> 3) Seagate Page Server

> 4) Seagate Web Component Server

> 5) A Database Server (optional)

>

> Let me know your current setup and we can go from

> there.Also let me know which operating system each

> server is on and which version of Crystal you are

> working with.

>

> -- Chris

Hello Chris,

From your message, it sounds like you were able to accomplish the Integration of reports with JSP.Could you please spare some time and guide me as well?

My JSP Server = TomCat

Web Server = IIS

pmk16 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Can I also use INCLUDE DIRECTIVE to achieve the desired result?<jsp:include page=" http://servername:8080/report.rpt" flush="true" />
pmk16 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hi Chris

I followed all your instruction regarding running crystal report through JSP.

But when I run the JSP page and click on Report link, It shows a window in which it shows the title Server Name = MY ODBC NAME and on next line title Database Name = MY DATABASE NAME and in last it ask to enter user id, and Password. BUt I save the User ID and Password when I created the ODBC.

Even when I enter the ID again here in this window it does not accept.

Please help me and let me know what should I do to resolve the problem.

Thanks

Sana

sanaullahs at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

I followed all your instruction to print the crystal report using JSP. but when I click on link to print the report it ask me again user id and password. Although I save the id and password when I created the ODBC. OK When I provide the ID and password here again it does not accept.

Please help me what should I do.

Sana

sanaullahs at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

Hey,

I know this response is a bit delayed (almost a year) but just in case anyone references it, I thought I'd answer the last question.

When using a URL to access an ODBC driven Crystal Report, you must add the user and password parameters to your URL.

http://SOME_URL?user0=id&password0=pw

If your report accesses multiple databases, just increment the paramters.

http://SOME_URL?user0=id0&password0=pw0&user1=id1&password1=pw1

That will clear up the call from the report asking for the login paramters.

Sorry for the delayed reponse, but I am firm believer in the "better late than never" postings.

-- Chris

carrich1 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10
Someone has created a website based on the information I provided in this posting. I've provided the link below. http://home.comcast.net/~pooja.mohan/files/hyperlink.html-- Chris
carrich1 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11

I followed all your instruction to print the crystal report using JSP. but when I click on link to print the report it ask me again user id and password. Although I save the id and password when I created the ODBC. OK When I provide the ID and password here again it does not accept.

Please help me what should I do.

afshin1334 at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12
How to print a crystal report using JSP?
edgar_rojas at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13

Hello carrich1,

I want to print a crystal report using jsp, I use JBuilder, sometime Tomcat5, on Window XP, Crystal Report 10.

I also want to print a dynamic report , passed by parameters in jsp.

I hope you read my message today and help me. urgent urgent

Lien from Vietnam.

lienntn at 2007-6-29 13:02:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...