0

My database is oracle and I have some datas which are blob.enter image description here

<p:dataTable id="fileList" value="#{yeniBelgeBean.listResim}" var="fileList">

                <p:column headerText="Dosya İsmi" >           
                    <h:outputText value="#{fileList.ad}" />
                </p:column>  

                <p:column headerText="Resim"> 
                    <p:graphicImage id="graphImage"  width="100" height="100" value="#{yeniBelgeBean.image}">
                        <f:param name="id" value="#{fileList.id}" />
                    </p:graphicImage>  
                </p:column>

                <p:column headerText="Seç"> 
                    <p:commandButton id="senImmage"  value="Goster" actionListener="#{userBean.ataID(fileList.id)}"  process="@this" update="@form" />
                </p:column>

 </p:dataTable>

Bean is(conversation scoped)

private GtbEtobsResim selectedResim = new GtbEtobsResim();

public List<GtbEtobsResim> getListResim() {
    return listResim = service.listFiles(selectedResim.getBelgeNo());
}

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

    if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
        return new DefaultStreamedContent();
    } else {
        String idStr = context.getExternalContext().getRequestParameterMap().get("id");
        selectedResim = service.getImageFile(Long.valueOf(idStr));
        StreamedContent img = new DefaultStreamedContent(new ByteArrayInputStream(selectedResim.getResim()), "image/png");
        //return new DefaultStreamedContent(new ByteArrayInputStream(im.getResim()));

        return img;
    }
}

UserBean is (session scoped)

public void ataID(Long id){      
    this.id=id;        
}

I want to download images which have same BELGE_NO when I push the commandbutton. Any solution in primefaces or any jsf component.

Tiny
  • 27,221
  • 105
  • 339
  • 599
aysegulP
  • 443
  • 3
  • 6
  • 18
  • Do you want query? Or you are not sure how to use blob record? – Subodh Joshi Aug 18 '15 at 11:20
  • I can show the images in a datatable with primefaces. But I don't download. I want to download them. – aysegulP Aug 18 '15 at 11:22
  • So you have to write the download program http://stackoverflow.com/questions/12645031/primefaces-download-file-from-datatable – Subodh Joshi Aug 18 '15 at 11:24
  • 1
    This question is too broad. At what step exactly are you stucking? Writing the SQL query? Creating the SQL query? Connecting the database? Executing the SQL query? Extracting the SQL query results? Obtaining an `InputStream` for each of them? Creating a ZIP file? Writing the individual `InputStream`s to ZIP file? Providing the ZIP file as download to enduser? Setting filename of the download? Etc. Breakdown your problem into tasks and solve each task individually. When you stucks at a specific task, just search/ask a question about exactly that task. – BalusC Aug 18 '15 at 11:33
  • Dear BalusC I send a message via linkedin – aysegulP Aug 18 '15 at 11:37
  • 1
    I generally ignore programming questions asked elsewhere outside Stack Overflow as they are not useful to other people :) – BalusC Aug 18 '15 at 11:48
  • As to the concrete problem, I gather you just want to know how to send an arbitrary file to enduser when a bean action method is invoked. In that case, this should be the answer you're looking for: http://stackoverflow.com/questions/9391838/how-to-provide-a-file-download-from-a-jsf-backing-bean – BalusC Aug 18 '15 at 11:49
  • Thanks I try it and also it is useful – aysegulP Aug 18 '15 at 11:50

0 Answers0