3 Replies Latest reply on Nov 17, 2008 5:58 AM by Ilya Shaikovsky

    fileUpload listener whith messages not rendered

    GUILLAUME LOUVEL Newbie

      Hello,

      I use fileUplaod and I want to render a messages if the filename is too long.
      So I use a rich:messages for display the message but the message is never display.

      I use RichFaces 3.2.0SR1.

      This is my code :

      <rich:messages id="messages-list" layout="list" tooltip="true" var="messages" styleClass="messages-error">
      </rich:messages>

      <rich:fileUpload fileUploadListener="#{xxxView.listener}" id="upload" acceptedTypes="*" uploadData="#{xxxView.data}" maxFilesQuantity="5" >
      <a4j:support event="onuploadcomplete" reRender="messages-list" />
      </rich:fileUpload>

      public void listener(UploadEvent event) throws IOException {
      UploadItem item = event.getUploadItem();
      if (item.isFile()) {
      File file = item.getFile();
      String fileName = item.getFileName();
      if (fileName.length() > 100) {

      getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "xxx", "xxx"));
      }
      else {
      }
      }
      }

      Could you help me please.

      Guillaume