Saturday, January 30, 2010

Struts2 DisplayTag Paging and Sorting using AJAX

In struts2, DisplayTag is a really good library for table data. It supports server side paging and sorting like the easiest way possible. Just set few properties on the JSP page, get few values in action class from request and wow, you got it working. Now the idea comes along like why not make it AJAXed, wouldn't that be awesome?. Certianly it would be.

AjaxTags and AjaxAnywhere provides support for that. Unfortunately, I wasn't able to make it work in any easy way. I wanted more control on my page, so I searched the web for more. Someone very cool and awesome was generous enough to post a different solution, just the thing I like. "Change in the source code."

Thursday, January 28, 2010

JSF Richfaces server side paging lazy loading

Few days back I wanted to take richfaces on a test drive. The organization I work in has lots of requirements for reports. I wanted to introduce JSF for its rapid and component based development. I found richfaces extremely nice to start with.
First thing on my mind was "can richfaces handle server side paging? i.e. only load chunk of data from the database that is required" since there could be a report which could bring 1,000,000 records. So if I want to show 10 records per page, is it possible to load only 10 records from the database instead of 1,000,000.

Richfaces does provide this functionality which I found on this page.

http://gochev.blogspot.com/2009/08/richfaces-server-side-paging-with.html

It worked. It uses datatable and datascroller with SerializableDataModel and ExtendedDataModel. This solution is good but I wanted something else. I wanted an easier solution. I wanted something like a pageNumber in my ManagedBean whenever a page number in datascroller is clicked and load chunk of data using that pageNumber and numberOfRecordsPerPage(lets say 10).

Wednesday, January 27, 2010

Crystal Reports Integration with Struts2

A task came along to integration Crystal Reports with struts2. After searching the web I came across a solution provided to integrate Crystal Reports with struts.

http://www.jroller.com/njain/entry/crystal_reports_plus_struts

Couldn't find one with struts2. So i changed it according to my requirements and after doing it successfully, I thought of sharing it with others.


The JSP is