Estou tentando pegar um objeto ao clicar em um commandLink que fica em cada coluna da DataTable, porém sempre da erro de nullPointerException. Alguem pode ajudar?
Estou fazendo dessa forma:
<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>
Método:
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());
}