java - Displaying Jasper Report on Browser in an ADF Application -


i have adf application have 1 .jsf page 1 button. have jasper report want show user in browser when user presses button. when user clicks button nothing happens, no error/exceptions , nothing in browser. here code

public string b2_action() {     try {         httpservletresponse response = getresponse();         servletoutputstream out = response.getoutputstream();         response.setheader("cache-control", "max-age=0");         response.setcontenttype("application/pdf");         servletcontext context = getcontext();         inputstream fs = new fileinputstream(new file(context.getrealpath("/reports/new.jasper")));          jasperreport template = (jasperreport) jrloader.loadobject(fs);         template.setwhennodatatype(whennodatatypeenum.all_sections_no_detail);          jasperprint print;         map<string, object> m = new hashmap<string, object>();         initialcontext initialcontext = new initialcontext();         datasource ds = (datasource) initialcontext.lookup("java:comp/env/jdbc/connds");          print = jasperfillmanager.fillreport(template, m, ds.getconnection());         //jasperviewer.viewreport(print, false);         jrpdfexporter exporter = new jrpdfexporter();         exporter.setexporterinput(new simpleexporterinput(print));         exporter.setexporteroutput(new simpleoutputstreamexporteroutput(out));         simplepdfexporterconfiguration configuration = new simplepdfexporterconfiguration();          exporter.setconfiguration(configuration);         exporter.exportreport();          facescontext.getcurrentinstance().responsecomplete();       } catch (exception e) {         e.printstacktrace();     }      return null; } 

i have libraries in class path, can see report in jasper viewer too, doing wrong here? kindly me.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -