I'm trying to pick up an object by clicking on a commandLink which is in each of the DataTable column, but always the nullPointerException error. Can someone help?
I'm doing it this way:
<p:commandLink id="ajax" ajax="false" process="@this"
actionListener="#{controleAuditoriaBean.prepDownload}" value="#{controleAuditoria.caminhoArquivo}">
<f:setPropertyActionListener
target="#{controleAuditoriaBean.solicitacoesBD}"
value="#{controleAuditoria}" />
<p:fileDownload value="#{controleAuditoriaBean.download}" />
</p:commandLink>
Method:
public void prepDownload() throws Exception {
System.out.println("Caminho "+solicitacoesBD.getCaminhoArquivo());
File file = new File(solicitacoesBD.getCaminhoArquivo());
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());
}