开发者

Using a .jasper file present within a jar file

We are using JasperReports as our reporting tool. Earlier we were using relative paths for jasper files for filling report and it's working fine.

Now, we want to create a new jar for all compiled jrxml files. i.e a jar containing all .jasper files for our project.

Is there a w开发者_JS百科ay to access those .jasper files within a jar file while filling report. Because in documentation, i always see

fillReport(java.lang.String sourceFileName, java.util.Map params)

where, sourcefile is always a path on filesystem.

My question is, is there a way to access compiled .jasper files present within a jar file and fill report based on those files ?

EDIT: Essentially what is required is, i need to access .jasper files from a jar file, and then fill reports using that .jasper file and save the generated reports onto a filesystem.


Most APIs worth using will provide overloaded methods to accept input streams. E.G. JasperFillManager.fillReport(InputStream, Map)

To get in InputStream, use Class.getResourceAsStream().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜