5 Replies Latest reply on Sep 3, 2008 3:33 AM by Heiner Lamprecht

    fileUpload: nothing happens

    Heiner Lamprecht Newbie

      Hi,

      I've a problem with rich:fileUpload. After clicking the upload button, I can see the progress bar, the stop button appears, but nothing happens on the server. the listener method is not even called. I don't get any error message. Even if I rename the listener method, I don't get any error.

      I'm using RichFaces 3.2.1 together with JBoss 4.2.2 and the JSF implementation coming with JBoss.

      What have I forgotten? Where can I find more error messages?

      Thanks in advance,

      Heiner

        • 2. Re: fileUpload: nothing happens
          Heiner Lamprecht Newbie

          Sure, here it is:

          The JSF file:

          <rich:simpleTogglePanel switchType="client" label="Upload Topology File" style="width: 420px;" opened="false">
           <a4j:form id="topo_file">
           <rich:fileUpload fileUploadListener="#{topoHandler.listener}"
           maxFilesQuantity="5" id="upload" immediateUpload="false"
           acceptedTypes="jpg, gif, png, bmp"
           listHeight="100px">
           <a4j:support event="onuploadcomplete" reRender="info" />
           </rich:fileUpload>
           </a4j:form>
          </rich:simpleTogglePanel>


          The bean:

          public class TopoFileHandler {
           private Logger log = Logger.getLogger(TopoFileHandler.class.getName());
           private static int fileCount = 0;
          
           public synchronized void listener(UploadEvent event) throws Exception {
           fileCount++;
           UploadItem item = event.getUploadItem();
           log.debug("File uploaded: " + item.getFileName() + " / " + item.getContentType() + " / " + item.getFile().length());
           }
          
           public int getSize() {
           log.debug("Size: " + TopoFileHandler.fileCount);
           return TopoFileHandler.fileCount;
           }
          }



          Cheers,


          Heiner

          • 3. Re: fileUpload: nothing happens
            senthil kumar Newbie

            Hi,
            Your JSF page and Bean file are proper. Your code is working perfectly in my system. I am using JBOSS 4.2.2 , richfaces 3.2.2 and default jsf impl coming with jboss. check if your bean configurations are proper.

            • 4. Re: fileUpload: nothing happens
              Heiner Lamprecht Newbie

              Hi,

              "sen_cool" wrote:
              Your JSF page and Bean file are proper. Your code is working perfectly in my system.


              Okay.

              The configuration in faces-config.xml is as follows:

              <managed-bean>
               <managed-bean-name>topoHandler</managed-bean-name>
               <managed-bean-class>my.package.TopoFileHandler</managed-bean-class>
               <managed-bean-scope>session</managed-bean-scope>
              </managed-bean>


              It is working, there are other methods of the beans, which are called correctly.

              How can I debug the whole stuff? I would like to see more of what is going on.

              Cheers,

              Heiner

              • 5. Re: fileUpload: nothing happens
                Heiner Lamprecht Newbie

                Hi there,

                I found the problem: The fileUpload is not working inside a rich:simpleTogglePanel. I don't know why, but removing the container element fixes the problem. Maybe it's related to this:
                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=141705


                Cheers,

                Heiner