Jump to content
JasperReports Library 7.0 is now available ×

How do I set the relative path to subreport


Recommended Posts

By: ryanwu - ryanwu

How do I set the relative path to subreport

2003-03-18 00:42

how can I set the relative path to subreport in my main report by iReport..

ex: <subreportExpression class="java.lang.String"><![CDATA[

"Report2_1.jasper"

]]></subreportExpression> ??

like above setting doesn't work

 

 

 

 

By: MMMMMM - mazzam

RE: How do I set the relative path to subrepo

2003-03-24 01:31

I'm having the same problem,

I want to run a report from a servlet, I'm able to specify the location of the master report, but I have to put the subreports in the classes dir.

How can I specify the location of the subreport???

TIA

Mauro

 

 

 

 

By: Davin Desborough - ddesborough

RE: How do I set the relative path to subreport

2003-03-25 13:01

I am using subreports in BEA/JSP and I simply pass the path of the sub report as a parameter when calling Jasper.

 

Jsp:

 

Map parameters = new HashMap();

parameters.put("ReportTitle", reportTitle);

parameters.put("Sort", sort);

parameters.put("subReport", "myPath/resoucesSub.jasper");

 

Java (jsp sets paramets before calling gen eration method):

JasperRunManager.runReportToPdfFile(fileName, outputFile, parameters, getConnection());

 

Jasper XML:

 

<parameter name="subReport" isForPrompting="true" class="java.lang.String"/>

...

<subreportExpression class="java.lang.String">$P{subReport}</subreportExpression>

 

-Davin

 

 

 

 

 

 

By: Teodor Danciu - teodord

RE: How do I set the relative path to subreport

2003-03-25 14:05

 

Hi,

 

With the about setting, you have to have the

Report2_1.jasper file in the current directory

(which I don't think is the case especially if you

are in Web environment) or have it in the classpath.

 

If you add the directory that contains this .jasper

file you your classpath, then the engine should

see it.

In web environment, the best way to do it is

to place the .jasper files under the

WEB-INF/classes directory as it is always part

of the classpath of you web application.

 

If you have, let's say, your subreport at

this location:

 

WEB-INF/classes/reports/Report2_1.jasper

 

then in the master report, it should be referenced

like this:

 

<subreportExpression class="java.lang.String">

<![CDATA[ "reports/Report2_1.jasper" ]]>

</subreportExpression>

 

I hope this helps.

Teodor

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...