0

こんにちは、netbeans IDE 7.2、primefaces 3.5、glassfish サーバー 3.1.2、mojarra 2.1.6 を使用しています。

アップロード後にアップロードされたファイルの名前を表示するためにoutputTextコンポーネントを使用しています。しかし、ファイル名を表示するように outputText コンポーネントが更新されることはありませんでした。助けてください。

私はこのxhtmlページを持っています:

<h:form enctype="multipart/form-data">
   <p:ajaxStatus>
       <f:facet name="start">
           <h:graphicImage value="images/loading.gif" />
       </f:facet>
       <f:facet name="complete">
        <h:outputText value="" />
       </f:facet>
   </p:ajaxStatus>
   <h:outputText value="#{bundle.AttachmentLabel}"/>
   <p:fileUpload fileUploadListener="#{testingPage.handleFileUpload}"
                 allowTypes="/(\.|\/)(doc|docx|ppt|pptx|xls|xlsx|pdf)$/"
                 update="attachmentname"/> 
   <h:outputText value="#{bundle.AttachmentLabel} #{bundle.YangLabel} #{bundle.AlreadyLabel} #{bundle.UploadedLabel}"/>
   <h:outputText id="attachmentname" value="{testingPage.attachmentfilename}"/>                            
</h:form>

これは、ViewScoped バッキング Bean の handleFileUpload リスナーです。

public void handleFileUpload(FileUploadEvent event) {
try {
       LogController.log.info("Assign attachment variable to event file property");
       attachment = event.getFile();
       LogController.log.info("Assign attachment byte to attachment contents");
       attachmentbyte = attachment.getContents();
       LogController.log.info("Assign attachment file name to attachment file name");
       attachmentfilename = attachment.getFileName();
    } catch (Exception ex) {
       LogController.log.fatal(ex.toString());
    }
}

何が間違っている可能性がありますか?プライムフェイスのショーケースは完璧に機能しています。助けてください。ありがとうございました。

4

0 に答える 0