在dilogue框中的jsf primefaces下载文件无法正常工作

时间:2015-07-27 04:43:11

标签: jsf primefaces

我想在我的jsf页面下载文件,下面是我的jsf页面

    $query1 = mysql_query("SELECT bus_id FROM schedule WHERE travel_agency_id = '".$travel_agency_id."' AND scheduleddate ='".$busDate."'");
    $query2 = mysql_query("SELECT bus_id FROM pc WHERE travel_agency_id = '".$travel_agency_id."' ");
    if(mysql_num_rows($query1) > 0 && mysql_num_rows($query2) > 0 ){
    $array1 = mysql_fetch_array($query1);
    $array2 = mysql_fetch_array($query2);
    $diff = array_diff($array2, $array1);
    print_r ($diff);
}

我的bean代码是:

         <h:form id="MyListForm"> 
         <p:commandButton value="Attachments" icon="ui-icon-transferthick-e-w" actionListener="#{myTeam.downloadImageDialogue}"
                    style="font-size: 10px;font-weight: bolder;vertical-align: text-bottom;width: 80px;" >
         </p:commandButton>
         </h:form>

和我的dilogue xhtml页面是:

         public void downloadImageDialogue() {
           RequestContext.getCurrentInstance().openDialog("AttachmentDialog");
        }

和bean代码是:

<h:body>
  <h:form>
    <p:dataTable var="Attachment" value="#{attachmentDialogView.attachmentList}" rows="10">
        <p:column headerText="File Name">
            <h:outputText value="#{Attachment.fileName}" />
        </p:column>
        <p:column headerText="Download Attachment">
                <p:commandLink ajax="false" id="dwldLink" action="#{attachmentDialogView.downloadImage}">
                <f:setPropertyActionListener value="#{Attachment.id.itemId}" target="#{attachmentDialogView.imageItemId}" />
                <f:setPropertyActionListener value="#{Attachment.fileName}" target="#{attachmentDialogView.fileName}" />
                <f:setPropertyActionListener value="#{Attachment.id.callId}" target="#{attachmentDialogView.callID}" />
                            <p:graphicImage value="images/dnld1.png" width="25" height="25"/>
                            <p:fileDownload value="#{attachmentDialogView.file}"/>  
                 </p:commandLink>
         </p:column>
    </p:dataTable>
    </h:form>
</h:body>

}

这里dilogue打开正确,但图片无法打开请帮助我。

0 个答案:

没有答案