Using inner class
Thursday, 16. April 2009, 19:55:22
Link: http://jajatips.blogspot.com/2009/04/using-inner-classes_6395.html
http://www.google.com/profiles/dooman87
Thursday, 16. April 2009, 19:55:22
Wednesday, 1. April 2009, 03:58:36
Monday, 19. January 2009, 06:45:19
Tuesday, 16. December 2008, 09:13:19
Thursday, 20. November 2008, 11:47:20
Tuesday, 11. November 2008, 09:40:56
Wednesday, 22. October 2008, 19:22:25
Monday, 29. September 2008, 04:43:12
Tuesday, 16. September 2008, 07:36:20
Tuesday, 11. March 2008, 10:32:22
<style name="Arial_Normal" isDefault="true" fontName="Arial"
fontSize="8" isBold="false" isItalic="false"
isUnderline="false" isStrikeThrough="false"
pdfFontName="ArialBold.ttf" pdfEncoding="KOI8-R"
isPdfEmbedded="true"/>
public String generateReport() {
try {
//Коннектимя к БД.
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/mysql/testdb");
Connection con = ds.getConnection("login", "password");
//Заполняем отчет.
JasperPrint print = JasperFillManager.fillReport(
"/tmp/jasper_test.jasper",
new HashMap(), con
);
//Экспортируем отчет в pdf файл.
JasperExportManager.exportReportToPdfFile(print,
getServletContext().getRealPath("") +
"/JasperTest/report.pdf"
);
} catch (Exception e) {
return e.getMessage();
}
//Возвращаем линк на сгенерированный отчет
return getServletContext().getRealPath("")
+ "/JasperTest/report.pdf";
}
<?xml version="1.0"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperReports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="SimpleReport" columnCount="4" columnWidth="100">
<style name="Arial_Normal" isDefault="true" fontName="Arial"
fontSize="8" isBold="false" isItalic="false"
isUnderline="false" isStrikeThrough="false"
pdfFontName="ArialBold.ttf" pdfEncoding="KOI8-R"
isPdfEmbedded="true"/>
<queryString>
<![CDATA[select Name,Street,Phone,E_Mail from Companys]]>
</queryString>
<field name="Name" class="java.lang.String"/>
<field name="Street" class="java.lang.String"/>
<field name="Phone" class="java.lang.String"/>
<field name="E_Mail" class="java.lang.String"/>
<background>
<band height="745">
<image scaleImage="FillFrame" hAlign="Left" vAlign="Bottom">
<reportElement x="0" y="0" width="595" height="745"/>
<imageExpression>"/tmp/image.gif"</imageExpression>
</image>
</band>
</background>
<columnHeader>
<band height="25">
<staticText>
<reportElement x="0" y="0" height="20" width="84"/>
<text>Name</text>
</staticText>
<staticText>
<reportElement x="140" y="0" height="20" width="84"/>
<text>Street</text>
</staticText>
<staticText>
<reportElement x="280" y="0" height="20" width="84"/>
<text>Phone</text>
</staticText>
<staticText>
<reportElement x="420" y="0" height="20" width="84"/>
<text>Email</text>
</staticText>
<line>
<reportElement x="0" y="21" width="555" height="0"/>
</line>
</band>
</columnHeader>
<detail>
<band height="30">
<textField>
<reportElement x="0" y="0" width="69" height="24"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{Name}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="140" y="0" width="69" height="24"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{Street}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="0" width="69" height="24"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{Phone}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="420" y="0" width="69" height="24"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{E_Mail}]]>
</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

Showing posts 1 - 10 of 12.
Good Day. In the last message from SDN, I received information about "Java EE Patterns and Best Practices Project". That is excellent idea, with excellent realization. I recommend to all developers that use Java EE to see this examples. To get it, you should have mercurial and checkout repository, ...
Good day! On the last week, we gave our software to support specialists. They installed the program to production servers. And over three thousand users began to work with it. At the on of that week, I didn't hear nothing about our product. This is good the good sign! :) But, we have one little pro ...
Hi all!In this post, I would like to tell about the way to optimize INSERT operation to database. In our project we use postgresql 8.3. I have big problems with speed on some operations. When I profiled the application, I find out that the biggest amount of time spent for JDBC operations. We getting ...