Basit bir dosya indirmeye çalışıyorum çalışıyorum ve tek alıyorum, asılı bir AJAX durum çubuğu ve işte bu. Yedek fasulye çıkışlarım, hazırlık ve indirme işleminde doğru adı verir.Primefaces Dosya İndirme çalışmıyor mu?
Bunu yanlış mı yapıyorum? Her iki çıktı da doğru görünüyor.
MTU 2.0 Primefaces 3,4
<h:form>
<p:commandButton id="downloadLink" value="Download" actionListener="#{filemanagement.prepDownload}">
<p:fileDownload value="#{filemanagement.download}" />
</p:commandButton>
</h:form>
yedekleme fasulye:
private DefaultStreamedContent download;
public void setDownload(DefaultStreamedContent download) {
this.download = download;
}
public DefaultStreamedContent getDownload() throws Exception {
System.out.println("GET = " + download.getName());
return download;
}
public void prepDownload() throws Exception {
File file = new File("C:\\file.csv");
InputStream input = new FileInputStream(file);
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
setDownload(new DefaultStreamedContent(input, externalContext.getMimeType(file.getName()), file.getName()));
System.out.println("PREP = " + download.getName());
}
Teşekkürler - Bir indirme (FF 17) için istemi yoktu. Ama bu bilgiyi takdir et (kaçırdı). Filiz çekirdekli fasulyenin – user2124871
kapsamı? – Manuel
Oturum - Görünümün kendisinde 3 form var. Hiçbiri birbirinin içine girmedi. Primefaces ve çoklu formların taslak olabileceğini okudum. – user2124871