Null Parameters in JSF Request

2

I'm trying to send a parameter to a Spring bean but I can not, the map is always empty. Here is my code below:

XHTML:

<h:dataTable columns="2" 
    value="#{tipoMaquinaView.objectSelecionado.imagens}" var="anexoImg" >
    <p:column>
        <p:graphicImage value="#{downloadUploadAnexo.image}"  cache="FALSE">
            <f:param name="anexo_id" value="#{anexoImg.id}" />
        </p:graphicImage>
    </p:column>
</h:dataTable>

Bean:

@Service
@RequestScoped
public class DownloadUploadAnexo implements Serializable {

@Autowired
private S3AnexoFacade s3AnexoFacade;

public StreamedContent getImage() {
    FacesContext context = FacesContext.getCurrentInstance();

    if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
        return new DefaultStreamedContent();
    } else {
        // Map abaixo sempre vazio
        Map<String, String> parameterMap = (Map<String, String>) context.getExternalContext().getRequestParameterMap();

        String anexoID = parameterMap.get("anexo_id");

        if (anexoID == null) {
            return new DefaultStreamedContent();
        }

        AnexoFacade anexoFacade = AppContext.getBean(AnexoFacade.class);    
        Anexo anexo = anexoFacade.buscarPorId(Long.valueOf(anexoID));

        InputStream stream = s3AnexoFacade.carregarArquivo(anexo.getCaminho());
        StreamedContent file = new DefaultStreamedContent(stream, anexo.getContentType(), anexo.getNome());     
        return file;
    }
}
    
asked by anonymous 13.10.2014 / 18:05

0 answers