I m using primefaces 3.5 and want to export my datatable as pdf or xml. I don't get any error but it doesn't work. When i clicked the button, page just refreshes itself. Also i added poi-3.9.jar and itextpdf but i got same result.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title> Cem Yeniçeri</title>
</h:head>
<h:body>
<h:form id="AraçBilgileriPaneli2">
<p:graphicImage id="savronik_image" value="/savronik.png" width="500" height="150"/>
<p:panel id="panel" header="Araç Bilgileri">
<h:panelGrid id="grid" columns="5" style="margin-bottom:10px">
<h:outputLabel value="Araç Seçiniz : "/>
<p:inputText value="#{json_vehicle.arac_id}" />
<p:commandButton value="Seçilen Aracın Bilgilerini Getir"
actionListener="#{json_vehicle.aracBilgileriniYukle(actionEvent)}" update="datatbl"/>
<p:commandButton value="Tüm Araçların Bilgilerini Getir"
actionListener="#{json_vehicle.aracBilgileriniYukle2(actionEvent)}" update="datatbl"/>
<p:commandButton value="Tablo Sil"
actionListener="#{json_vehicle.tabloSil(actionEvent)}" update="datatbl"/>
</h:panelGrid>
<p:messages id="messages3" showDetail="true" autoUpdate="true" closable="true" />
</p:panel>
<br/><br/>
<p:dataTable id ="datatbl" var="v" value="#{json_vehicle.vehicles}">
<p:column headerText="Araç No">
<h:outputText value="#{v.vehicle_id}"/>
</p:column>
<p:column headerText="Araç Adı">
<h:outputText value="#{v.vehicle_name}" />
</p:column>
<p:column headerText="Tarih">
<h:outputText value="#{v.record_date}" />
</p:column>
<p:column headerText="Araç Sahibi">
<h:outputText value="#{v.owner}"/>
</p:column>
<p:column headerText="Araç Tipi">
<h:outputText value="#{v.vehicle_type}" />
</p:column>
<p:column headerText="Tahsis Yeri">
<h:outputText value="#{v.allocated_region}" />
</p:column>
</p:dataTable>
<p:panel header="Export All Data">
<h:commandLink>
<p:graphicImage value="xml.png" />
<p:dataExporter type="xml" target="datatbl" fileName="myxml" />
</h:commandLink>
<h:commandLink>
<p:graphicImage value="pdf.png" />
<p:dataExporter type="pdf" target="datatbl" fileName="mypdf" />
</h:commandLink>
</p:panel>
</h:form>
</h:body>
</html>
try to use this dependencies:
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
or download it manually if u don't use maven. additionally, make sure you use 'ajax=false' property in p:commandLink.