Exporting CSV using JSF 2.1
If you want to export CSV using JSF read on. The following steps tell you how easy it is.
- Install the JSF CSV JAR file.
- Create a JSF page with the proper render kit id and content type
- Demo it!
Install the JSF CSV JAR file
If you are non-Maven user you will need to download the JAR file manually from
http://www.manorrock.com/repo/com/manorrock/jsf/com-manorrock-jsf-csv/.
And copy it into your WEB-INF/lib directory.
If you are a Maven user use the following dependency:
<dependency>
<groupId>com.manorrock.jsf</groupId>
<artifactId>com-manorrock-jsf-csv</artifactId>
<version>2.0.1</version>
</dependency>
Create the JSF page with the proper render kit id and content type
<f:view
renderKitId="CSV"
contentType="text/csv"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:dataTable var="item" value="#{csvBean.table}">
<h:column>
<f:facet name="header"><h:outputText value="one"/></f:facet>
<h:outputText value="#{item.columnOne}"/>
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="two"/></f:facet>
<h:outputText value="#{item.columnTwo}"/>
</h:column>
</h:dataTable>
</f:view>
Demo it!
And head on over to http://www.manorrock.com/demo/jsf/csv/ to see it in action!
- Login or register to post comments
- Printer-friendly version
- mriem's blog
- 1785 reads






Comments
I opened up the source and see that it has a generic ...
by jyeary - 2011-11-08 06:21
I opened up the source and see that it has a generic license. I think you would have a better chance at adoption from a corporate standpoint if you provided an approved open source license. As an example, our company would accept Apache 2, and MIT, but would not accept GPL v2, or v3.
Interesting project, and demo. What is the license for the ...
by jyeary - 2011-11-08 06:14
Interesting project, and demo. What is the license for the software?
The license is a simplified BSD-style license. ...
by mriem - 2011-11-08 07:37
The license is a simplified BSD-style license. See http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29.