<html xmlns="http://www.w3.org/1999/xhtml" xmlns:a="http://jarch.com/jsf/ui" xmlns:e="http://jarch.com/jsf/ui/extension"> <a:form> <e:commandLinkDownload id="ajax" label="#{a:bundle('label.download')}" actionListener="#{buttonAction.preparaArquivoDownload}" streamedContent="#{buttonAction.arquivoDownload}" /> </a:form> </html>
@JArchViewScoped public class ButtonAction { private void preparaArquivoDownload() { InputStream stream = ((ServletContext) FacesContext.getCurrentInstance() .getExternalContext().getContext()).getResourceAsStream("/resources/images/dsf_logo.jpg"); arquivoDownload = new DefaultStreamedContent(stream, "image/jpg", "downloaded.jpg"); } }