Jump to content
We've recently updated our Privacy Statement, available here ×

JRExporterParameter.OUTPUT_FILE null


europe72

Recommended Posts

 Hello,

 

I'm currently in the process of coding a Servlet, which creates a JasperPrint object, and subsequently exports it via JRExporter. Below is a snippet of code from that Servlet. I was attempting to create a File obj from the OUTPUT_FILE, however OUTPUT_FILE is null even after exportReport() is called. Should it be?

 

 

Code:
...                               ServletOutputStream os = response.getOutputStream();				exp.setParameter(JRExporterParameter.CHARACTER_ENCODING,						p.get("encoding"));				exp.setParameter(JRExporterParameter.JASPER_PRINT, jp);				exp.setParameter(JRExporterParameter.OUTPUT_STREAM, os);				try {					exp.exportReport();				} catch (JRException e) {					response.sendError(							HttpServletResponse.SC_INTERNAL_SERVER_ERROR,							e.getLocalizedMessage());					e.printStackTrace();				}				File f = (File) exp						.getParameter(JRExporterParameter.OUTPUT_FILE);				response.setContentLength((int) f.length());				os.flush();				os.close();...
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...