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

 

Hi,

 

Elements that overlap are not handled by the HTML

exporter. Make sure your line element does not overlap

with other elements.

 

Thank you,

Teodor

 

 

 

 

 

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();

 

response.setContentType(CONTENT_TYPE);

 

PrintWriter out = response.getWriter();

 

try {

System.setProperty(

"jasper.reports.compile.class.path",

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

System.getProperty("path.separator") +

context.getRealPath("/WEB-INF/classes/")

);

 

Map parameters = new HashMap();

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

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

 

JasperReport jasperReport =

JasperCompileManager.compileReport(context.getRealPath(

"jq_good_detail.xml"));

 

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=");

exporter.exportReport();

 

}

catch (JRException e) {

out.println("<html>");

out.println("<head>");

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

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

out.println("</head>");

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

out.println(

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

out.println("<pre>");

out.println("</pre>");

out.println("</body>");

out.println("</html>");

e.printStackTrace(out);

}

catch (Exception ex) {

ex.printStackTrace();

}

}

 

private static Connection getConnection() throws ClassNotFoundException,

SQLException {

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

String url =

"jdbc:microsoft:sqlserver://Gbs-mainserver:1433;DatabaseName=GOV";

Class.forName(driver);

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