我正在使用 primefaces 3.5 并希望将我的数据表导出为 pdf 或 xml。我没有收到任何错误,但它不起作用。当我单击按钮时,页面会自行刷新。我还添加了 poi-3.9.jar 和 itextpdf 但我得到了相同的结果。
<?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>