My name is Anh Quan Nguyen, from Saigon, Vietnam.
I am currently living in Frankfurt, Germany.
I like to blog about Web 2.0, JasperReports, Portal/Portlet, JSR168, DWR, Dojo, Struts... and so on.
A little bit about my background. In March 2003, I graduated Bachelor in Electronics, Hochiminh City University of Technology. Then I got a position as Electronic Engineer in Sony. Tivi production made me tired. I decided to change my career. In September 2004, I came to Germany to take the Master Course in Communication and Media Engineering. Here I also do not know exactly my real way, become a telecom. engineer or a software developer. After a while of listening to my heart, I know I have no other choice than to become a programmer. It's quite a little bit late, but it's better than going to the wrong way for the rest of my life.
Thank you for visiting my website. And if you are professional programmer, please help me with your knowledge.
Nice to know you all !
December 02, 2006
About me
OutOfMemory - How to avoid it ?
Sometimes, you encounter the OutOfMemoryException because JasperReports tries to fill data which are bigger than memory allocated to JVM.
Don't be panic. JasperReports can split a big report to smaller segments and store these segment in a temporary directory in your drive.
What you have to do is to set the built-in parameter REPORT_VIRTUALIZER
Take a look at the code below:
//Create connection to database server
connection = ConnectionPool.getConnection();
//Create a cache at C:\Temp
JRFileVirtualizer fileVirtualizer = new JRFileVirtualizer(3, "c:\\Temp");
//Set parameter REPORT_VIRTUALIZER
HashMap parameterMap = new HashMap();
parameterMap.put(JRParameter.REPORT_VIRTUALIZER, fileVirtualizer);
//Fill data as usual
JasperFillManager.fillReportToFile("MyReport.jasper", parameterMap,connection);
Good luck !
Struts and XDoclet
Type your summary here.
Type the rest of your post here.
Portlet development with XDoclet, ANT
Type your summary here.
Type the rest of your post here.
Struts based porlet in Liferay Portal
Type your summary here.
Type the rest of your post here.
Struts resources (eBooks, articles, tutorials)
Type your summary here.
Type the rest of your post here.
Struts development in MyEclipse
Hướng dẫn cách sử dụng MyEclipse để phát triển Struts application
Type the rest of your post here.
HelloWorld Struts Application
Chương trình cơ bản sử dụng Struts
Type the rest of your post here.
JasperReports Resources (eBooks, articles, tutorials)
eBooks:
1.
2.
3.
4.
5.
6.
7.
Articles:
Tutorials:
Type the rest of your post here.
Jasper Report Printing from Servlet
In this post I will show you how to write a simple Servlet to view PDF reports on web browser.
The source code is quite simple and self exlained.
Take a look !
|
That's all !
Create more readable report with conditional Formatting
Khi tạo report, bạn sẽ thấy nếu sử dụng conditional formatting thì sẽ tạo được những report rất đẹp. Ví dụ, đối với field kiểu boolean, thay vì hiện giá trị true/false, bạn có thể xuất dấu check (dạng file image). Làm việc đó như thế nào? Thực sự cũng không quá phức tạp.
Type the rest of your post here.
How to use SubReports
Để tạo một report phức tạp, bạn không thể sử dụng một file jrxml đơn lẻ được. Trong trường hợp này, để đơn giản, bạn có thể chia main report thành các subreport để dễ quản lý.
Type the rest of your post here.
Dynamic datasource & embedded SQL
Trong JasperReport, bạn có thể nhúng lệnh SQL trong file jrxml hoặc có thể truyền data bằng datasource. Cách nào hay hơn ? Lần này tôi sẽ so sánh ưu và nhược điểm của hai phương pháp này.
Type the rest of your post here.
Create better quality Chart in PDF format
Bạn sẽ để ý rằng khi tạo Chart trong JasperReports và export ra PDF, Chart nhận được rất xấu, đặc biệt là các ký tự và số (đôi khi mờ không thấy chữ). Tại sao? Đó là do PdfExporter của JasperReports convert Chart ra dạng pixel, sau đó mới in ra PDF. Mà đương nhiên là các chữ số dạng pixel thì không thể rõ bằng các chữ số dạng text được rồi. Bạn không thể dùng Select Tool trong Acrobat Reader để chọn các chữ số trong Chart, mà chỉ có thể select chart như một hình ảnh. Bài viết này sẽ hướng dẫn bạn các vượt qua khó khăn này.
Type the rest of your post here.
Force PageBreak in JasperReports
Trong MS Access, bạn có thể dễ dàng "ép" report nhảy qua trang mới. Nhưng việc này không dễ dàng tí nào trong JasperReports. Bài viết này hướng dẫn bạn vượt qua hạn chế này của Jasper
Type the rest of your post here.
How to use Crosstab
Crosstab hay còn gọi là PivotTable trong Excel và Access. Làm thế nào để tạo Crosstab trong JasperReports. Bài viết này sẽ hướng dẫn chi tiết cách tạo Crosstab.
Type the rest of your post here.
How to use ChartCustomizer
JasperReports use jFreeChart as a charting library. However many features in jFreeChart are not yet supported in JasperReports. With the help of customizer, you can fully control jFreeChart.
I took me quite a while to learn how to customize the jFreeChart in JasperReports.For example, we cannot change the size of bars in BarChart, or we cannot add a complicated dynamic subtitle.
Like scriptlets, Customizer is automatically invoked during the filling process.
Your own customizer class must implement net.sf.jasperreports.engine.JRChartCustomizer interface. This interface has only one method customize(org.jfree.chart.JFreeChart chart, JRChart jasperChart).
Here is one example:
| |
|
That's so far for today!
How to use Scriptlets
Scriptlets allow you to execute snippets of Java code (or other language) during the filling process.
Your custom Scriptlet class must extend either JRDefaultScriptlet or JRAbstractScriptlet, and override these methods:
beforeReportInit,
afterReportInit,
beforePageInit
...
The name of the methods also show when the methods will be invoked.
Here is an example.
| |
|
After writting the scriptlet class, you need to set the scriptletClass atribute to the fully qualified name of the scriptlet class. For example,
< jasperReport
name="tracking_part5"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="782"
pageHeight="595"
columnWidth="782"
columnSpacing="0"
leftMargin="0"
rightMargin="0"
topMargin="0"
bottomMargin="0"
whenNoDataType="NoPages"
scriptletClass="com.db.report.jasper.custom.trackingreport.TrackingReportScriptlet" isTitleNewPage="false"
isSummaryNewPage="false">
That's all !