Jump to content

subreport paths so Ireports and java can find them


arianhojat

Recommended Posts

Ive seen in message boards a couple times that someone will say in your java apps to pass the subreport location in a parameter with parameters.put( 'sub1', application.getPath('/reports/myreport.jasper')) so the full path to the subrepotr file is passeed as a paremter to get the subreport name and therefore found,

 

or somehow just in the jrxml use the path relatively so both find it?.

 

But i am unsure how to get it to work so if user is viewing NOT from my java app but from Ireports. Hence 1st method wont work. I need to make it work with both.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

i think i will set a param in main jrxml file for each subreport.

 

The params default value will be for example sub1.jasper or the full absolute filepath, both would work (prefer relative in case move the file somewhere).

If run from iReports this default is the value it will use.

 

my tomcat app can supply in parameters to the report a absolute filepath which is based on relative location. So like the report files are all under tomcat/webapps/jasper/reports. Ireport user has access and can open a report from reports.

The tomcat app, which is in /jasper, can find the file like so:

parameters.put(

"sub1",

application.getRealPath("/reports/sub1.jasper")

);

 

Hence both can find file appropriately theoretically (didnt try yet, just writing down idea :) ).

 

 

Not sure why the boards are so dead here for vastly used product. Frustrating.

Link to comment
Share on other sites

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