vispi_3 Posted July 9, 2010 Share Posted July 9, 2010 hiI am developing a struts 2 web application with jboss portlets and i want to include jasperreports in itI had placed the .jrxml file in the project itself in the selfcare->webContent->reports->amount.jrxml and i m deploying my application by creating a war file.While specifying the location of the file name what should i specify it?JasperDesign jaspdes = JRXmlLoader.load("/selfcare/reports/amount.jrxml"); jasperreport = JasperCompileManager.compileReport(jaspdes);I am getting the filenotfoundexception.can i use the portletcontextpath for specifying the location?Can any one please help me... Code: Link to comment Share on other sites More sharing options...
lacito Posted July 13, 2010 Share Posted July 13, 2010 Hi, Use the servlet context to obtain an InputStream. InputStream is = null;try{ is = context.getResourceAsStream("/selfcare/reports/amount.jrxml"); JasperDesign jaspdes = JRXmlLoader.load(is); jasperreport = JasperCompileManager.compileReport(jaspdes);}finally{ is.close();} 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