rajeevt Posted February 27, 2007 Share Posted February 27, 2007 I am trying to deploy a jasperreport with a subreport in Tomcat environment. The normal reports without subreport work perfectly. However, the master report has a SUBREPORT_DIR parameter from where it should pickup the subreport.jasper. What is the value I should be passing to this parameter? I have tried various options but always get an exception saying couldn't load the object from the directory. The syntax I use is as below: private static final String PREFIX = "/WEB-INF/reports/"; private static final String SUFFIX = ".jasper"; externalContext econtext = getExternalContext(); InputStream stream = econtext.getResourceAsStream(PREFIX + name + SUFFIX);JasperPrint jasperPrint = null; jasperPrint = JasperFillManager.fillReport(stream, params, conn); RegardsRajeev Link to comment Share on other sites More sharing options...
rajeevt Posted February 27, 2007 Author Share Posted February 27, 2007 I have managed to solve it. I had to pass ../reports in my SUBREPORTS_DIR path to make it work. Any absolute path gave problem. RegardsRajeev Link to comment Share on other sites More sharing options...
javydreamercsw Posted March 8, 2007 Share Posted March 8, 2007 Any idea how this is done from the report itself? Not from code. The SUBREPORT_DIR must have certain value? Can it be passed as a parameter from Jasperserver? if yes how? Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted March 9, 2007 Share Posted March 9, 2007 Forget the parameter SUBREPORTS_DIR, and use as expression for your subreport something like: "repo:yourReport" where yourReport is the name of the resource containing the jrxml of your subreport: infact the best wat to use subreports in JS is to load the subreport jrxml as resoure in your report unit and refer it by resource name. Giulio Link to comment Share on other sites More sharing options...
javydreamercsw Posted March 9, 2007 Share Posted March 9, 2007 Will "repo:yourReport" be affected somehow by placement within the repository? i.e. folders and subfolders? Link to comment Share on other sites More sharing options...
jsmetz_juneau Posted March 31, 2007 Share Posted March 31, 2007 I am struggling with using a URL to call a parent report containing a subreport. I have a servlet engine on a tomcat server which will send a .jasper file to a browser. The URL calls the .jasper subreport with no error, but when calling the parent report I get a can't find the (subreport name) file error. I've tried various path combinations, and I've tried your "repo:reportName" (see image below), but none have worked. Do you have any guidance you can give me on how to get the parent report to properly call the subreport from a tomcat server? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now