Jump to content

About Export to HTML

Recommended Posts

By: susun - wellrun

About Export to HTML

2003-07-09 01:01

When i export the report to HTML,why the table line in the report cant display correctly?





By: Teodor Danciu - teodord

RE: About Export to HTML

2003-07-09 02:09




Elements that overlap are not handled by the HTML

exporter. Make sure your line element does not overlap

with other elements.


Thank you,







By: susun - wellrun

RE: About Export to HTML

2003-07-11 02:24

Appreciating for your reply. Thank you.

It seems like all the image elements cant display correctly.Coz the page just display the letter and it has such Exception :


2003-07-11 15:31:58 invoker: Cannot allocate servlet instance for path /Welcome/servlet/image

javax.servlet.ServletException: Wrapper cannot find servlet class image or a class it depends on.



The other Exception is :

java.lang.ClassNotFoundException: image

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1443)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)



Thank you :)





By: susun - wellrun

RE: About Export to HTML

2003-07-13 18:15

My web server is Tomcat4.1,when i run the JasperReport Demo HtmlServlet in the package webapp,it has the same question,that the image cant display correctly,just display letter.


Thank you.





By: susun - wellrun

RE: About Export to HTML

2003-07-14 00:25

Sorry,Correct the previous information.

When i run JasperReport Demo HtmlServlet,it is useful. I replace this Demo's XML Design and datasource with mine and it is useful also.But when i run my personal Servlet to export it to HTML,table lines cant displayed correctly,it just display the letter.But the demo HtmlServlet with mine almost same.


Expecting your reply. Thank you very much.





By: susun - wellrun

RE: About Export to HTML

2003-07-14 00:31

Below is my Source Code ,thank you.


import dori.jasper.engine.*;

import dori.jasper.engine.util.*;

import dori.jasper.engine.export.*;


import java.io.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;


import java.sql.*;





public class JasperServlet extends HttpServlet {


//Initialize global variables

private static final String CONTENT_TYPE = "text/html; charset=GB2312";





public void service(

HttpServletRequest request,

HttpServletResponse response

) throws IOException, ServletException {


ServletContext context = this.getServletConfig().getServletContext();




PrintWriter out = response.getWriter();


try {



context.getRealPath("/WEB-INF/lib/jasperreports.jar") +

System.getProperty("path.separator") +




Map parameters = new HashMap();

parameters.put("date_begin", "2003-06-01");

parameters.put("date_end", "2003-06-30");


JasperReport jasperReport =




JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,

parameters, getConnection());


JRHtmlExporter exporter = new JRHtmlExporter();


Map imagesMap = new HashMap();

request.getSession().setAttribute("IMAGES_MAP", imagesMap);


exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);

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




catch (JRException e) {



out.println("<title>JasperReports - Web Application Sample</title>");

out.println("<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">");


out.println("<body bgcolor="white">");


"<span class="bnew">JasperReports encountered this error :</span>");







catch (Exception ex) {





private static Connection getConnection() throws ClassNotFoundException,

SQLException {

String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";

String url =



Connection conn = DriverManager.getConnection(url, "artscn", "artscn");

System.out.println("The connection is :" + conn);

return conn;



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...