Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2006, 04:53 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default jasper reports

how to generate html reports using jasper reports

please help

if somebody know about this then please replay with the

code

thanks
hrishi

 
Old July 17th, 2006, 11:29 PM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

   There is an example to generate html output in webapps of jasperreport jar file.Anyway the following is the code for html output:

JasperPrint jasperPrint =JasperManager.fillReport(jasperReport, parameters, conn);

Map imagesMap = new HashMap();
        req.getSession().setAttribute("IMAGES_MAP", imagesMap);

        JRHtmlExporter exporter = new JRHtmlExporter();

        exporter.setParameter(JRExporterParameter.JASPER_P RINT, jasperPrint);

        exporter.setParameter(
            JRExporterParameter.OUTPUT_WRITER,
            resp.getWriter());

        exporter.setParameter(JRHtmlExporterParameter.IMAG ES_MAP, imagesMap);

                exporter.setParameter(
            JRHtmlExporterParameter.IMAGES_URI,
            "image?image=");


        exporter.exportReport();


You have to mention a imageservlet which has the following code:
public class ImageServlet extends HttpServlet
{



    public void service(
        HttpServletRequest request,
        HttpServletResponse response
        ) throws IOException, ServletException
    {


        Map imagesMap = (Map)request.getSession().getAttribute("IMAGES_MAP ");

        if (imagesMap != null)
        {
            String imageName = request.getParameter("image");
            if (imageName != null)
            {
                byte[] imageData = (byte[])imagesMap.get(imageName);

                response.setContentLength(imageData.length);
                ServletOutputStream ouputStream = response.getOutputStream();
                ouputStream.write(imageData, 0, imageData.length);
                ouputStream.flush();
                ouputStream.close();
            }
        }
    }


}

   just compile and run the code ,u can generate HTML o/p.

Thanks




 
Old July 23rd, 2006, 02:41 AM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to yash1810
Default

sir...
we r using wistone server..IBM j9 jvm.....working on pocketpc 2003 second edition...the prob is that...the jar we r using in lib folder are
"ant,axis,commons-el,commons-io-1.1,commons-logging,commons-logging-1.0.4,commons-logging-api,db4o-5.0-java1.2,dRS-1.0-core,jasper-compiler,jasper-runtime,jaxrpc,runtime,tools,winstone-0.8.1" these are from tomcat from these when we r running our jsp...on winstone then there is compilation error that servlet unable to complie...

but if we the previous jasper jar... with the "jar jasper-compiler-5.5.15,jasper-compiler-jdt-5.5.15,jasper-runtime-5.5.15" which from jetty server....now what is happen is that the prob of comilplation is solved...but new prob occurs.. after run on jsp page and compilting also...after that the server shutdown...so gone accross this situation plz help me becoz seriouly in trouble.....


Yash

 
Old August 4th, 2006, 04:53 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have an urgent problem!!
i had used the code fiiling bellow by Babitha!
this code work correctly but i didnt find the html report!!
where it i was generated??
i want to generate him in a specified adresses?
please help me!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Jasper Reports devi.g@india.com J2EE 4 December 4th, 2007 11:02 PM
Jasper Reports bcg J2EE 1 October 30th, 2007 04:05 AM
jasper reports hrishi BOOK: Beginning JavaServer Pages 0 May 29th, 2006 04:51 AM
New to jasper reports venz98 J2EE 4 March 9th, 2006 10:59 AM
New to Jasper reports laviananth J2EE 0 April 7th, 2005 04:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.