Export JSF Datatable to Excel

Lately I’ve committed a new component to the MyFaces Sandbox. It’s called ExcelExport and used to export the contents of a datatable as a regular excel file using Apache POI. The component must have a child that has onclick attribute, following is an example using a command button.

<s:excelExport for=”tableIdHere”>
<h:commandButton value=”Export” />
</s:excelExport>

Also the example in myfaces repo:
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/excelExport.jsp

For now it only works with server side state saving, using ajax and sending the view with the ajax request I’ll make the component start working with the client side state saving too. In my old project I’ve embedded this feature to the datatable itself by placing an excel icon on the top-right corner. The screenshots of my old work is here. The one I’ve added to myfaces sandbox is more flexible since it can be used with different types of child components, actually the idea behind the scenes is same but the usage is different.

Update(06 May 2009): For the ultimate JSF export datatable(excel, pdf, csv, xml) experience see PrimeFaces Exporter.

Posted in Java. 5 Comments »

Maven Plugins for Hibernate and JSF Annotations

Jason Van Zyl, founder of the Apache Maven sent an email to the apache committers mailing list about maven sandbox module. In his email he has announced that all the apache committers have now access to the maven sandbox so every committer can directly contribute to the maven project. Me and Sylvain Vieujot(Apache MyFaces PMC) talked about this when we’re in Dubai, he has written two maven plugins for hibernate annotations and jsf annotations.

Hibernate annotations plugin checks through the classpath and adds the <mapping class=”blablabla” /> tags to the hibernate.cfg.xml if it sees something like @Entity. The advantage is that you don’t need to maintain the mappings in the hibernate.cfg.xml for each entity you’ve annotated with hibernate annotations, they are all generated. Yesterday I’ve added a new feature to cache the generated config file to give some performance boost to the execution. So the config file is not generated each time it’s executed, this leads to a significant reduce in the execution time.

JSF annotations plugin implements a similar idea, goes through the classpath and generates the faces-config.xml from the information it collects. It was only working for managed beans and navigations, lately I’ve added new features to realize converters, validators, phaselisteners and etc.

There are still some work and refactoring left todo about them but since maven sandbox is open to all apache committers, we’ll probably commit the plugins to the maven repository soon.

Posted in Java. 2 Comments »

.NET Community doesn't get it

I was in Dubai last week where I’ve met Kevin Jackson who is an active committer and PMC member of the Apache ANT project. When I mentioned him that I worked with .NET in the past and didn’t enjoyed it because of the lack of community, he told me an interesting story about NDOC that summarized the whole situation.

NDOC is one of the greatest open source projects in .NET and is used to generate documentation from the code. Some time ago Kevin Downs the author of the NDOC announced that the project is dead and he won’t work on it anymore. As he mentioned in his mail to the NDOC mailing list, there are couple of reasons that lead to his decision. But the most important one in my point of view is that there is a lack of contributon from the .NET developer community to the project. I mean it’s a very popular project which is used in almost every .NET project but strangely noone thinks of doing any contribution. On the other hand Microsoft has started a similar project called SandCastle to generate docs. It’s obvious that .NET community will switch to SandCastle when it’s finished and stop using of NDOC. Considering all of these noone can expect the motivation needed to continue the project from the author.

Suppose you’ve created a nice open source tool for .NET and just like in NDOC case Microsoft comes up with a similar solution, at that time all the work you’ve spent for the community will be a waste of time because it’s obvious people will start using the MS’s productions. This is one of the significant reasons preventing people from stepping up and creating projects for .NET.

This example summarizes the huge difference between the .NET community(if such a thing exists) and JAVA community. Open source in JAVA is driven by volunteers and the support from the community is great. An example from me will be the contributions I’ve received for my personal open source stuff like JSF Chart Creator from Brazil, Australia and etc. This is the main thing, .NET developers just don’t get it because their community is not driven by them but just by Microsoft.

Posted in Java. 3 Comments »

Business Trip to Dubai

Tomorrow I’ll be travelling to Dubai for a business trip where I’ll join my project team. The guys I’ll meet are Sylvain Vieujot (Apache MyFaces PMC member), Kevin Jackson(Apache Ant PMC Member) and a friend of Kevin’s who’s also in the team. I’ve never been to Dubai before but I know it’s a nice place to visit. I’ll spent my 3 days trip with meetings and cruising around the city:). Anyway I hope it’ll be fun.

Posted in Java. Comments Off