Growl not working with FileUpload

UI Components for JSF
Post Reply
fissk
Posts: 14
Joined: 19 Apr 2011, 12:18

19 Apr 2011, 12:34

Hi All,

Just joined and it's my first post so I think congratulations on marvelous work for Primefaces team are due.


I'm running JSF2 with Mojarra on Tomcat 7.0.11 and Primefaces 3.0.M1. Everything works smoothly apart from when I'm using FileUpload. The upload works all right all the way through, no problem's here. But the Growl messages never come up. I've testes on Primefaces 2.2.1 as well and get the same thing. Elsewhere Growl messages are working just fine but for some reason they won't with FileUpload component. I've checked if all resources are loaded correctly and if everything is in place (css, js etc ) .

If someone had encountered this problem before I'd appreciate any help.

Many Thanks,
Fissk
Tomcat 7.0.19 Mojarra 2.1.2, Primefaces 3.0M2

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

19 Apr 2011, 12:36

is your growl set to auto-update or do you have to update it manually?

fissk
Posts: 14
Joined: 19 Apr 2011, 12:18

19 Apr 2011, 12:44

Hi robert.m,

Thanks for your prompt reply.

I am using pretty much exactly same code as one given on the showcase site

Code: Select all

        
<h:form enctype="multipart/form-data" prependId="false">
         <p:growl id="uploadStatus" showDetail="true"/>  
  
        <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"  
            mode="advanced"  
            update="uploadStatus"   
            multiple="true"  
            sizeLimit="2000000"  
            allowTypes="png,gif,jpg"/>  
        </h:form>
If i set growl to autoUpdate still nothing.
Tomcat 7.0.19 Mojarra 2.1.2, Primefaces 3.0M2

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

19 Apr 2011, 15:31

Can you post the code of your backing bean? i.e. the code of your fileUploadListener

fissk
Posts: 14
Joined: 19 Apr 2011, 12:18

19 Apr 2011, 19:44

Code: Select all

import java.io.Serializable;

import javax.inject.Named;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.event.FileUploadEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 *
 * @author fissk
 */
@Named(value = "fileUploadController")
@RequestScoped
public class FileUploadController implements Serializable
{
    private Logger logger = LoggerFactory.getLogger(FileUploadController.class);
    
    /** Creates a new instance of FileUploadController */
    public FileUploadController()
    {
    }

    public Logger getLogger() {
        return logger;
    }

    public void setLogger(Logger logger) 
    {
        this.logger = logger;
    }

    public UploadedFile getUploadedFile() 
    {
        return uploadedFile;
    }

    public void setUploadedFile(UploadedFile uploadedFile) 
    {
        this.uploadedFile = uploadedFile;
    }
    
    
    
    
    
    

  
    public void handleFileUpload(FileUploadEvent event) 
    { 

        logger.info("Uploaded: {}", event.getFile().getFileName());  
        
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, event.getFile().getFileName(), " uploaded successfully.")); 
    
        
    } 
}



Again this is just to test if the upload module is functioning, without the actual file handling code. It works fine and what's more it works with p:message or p:messages but never with growl. Any ideas?
Tomcat 7.0.19 Mojarra 2.1.2, Primefaces 3.0M2

honyk
Posts: 150
Joined: 28 Sep 2010, 11:14

19 Apr 2011, 20:27

Not very related, but what browser do you use? I've found recently in MSIE9 there is problem with update event. It can be checked also in Test Case - if autoupload is tested, no growl appear in MSIE9 while everything is Ok in Firefox.

fissk
Posts: 14
Joined: 19 Apr 2011, 12:18

20 Apr 2011, 10:09

It doesn't work regardless of what the browser is.
Tomcat 7.0.19 Mojarra 2.1.2, Primefaces 3.0M2

half_duplex
Posts: 13
Joined: 20 Dec 2011, 22:52

05 Jan 2012, 22:37

Was this issue ever resolved?

There are instances in the showcase it self where growl does not work properly.

DataTable complex being one.
IBM RBD - Eclipse - IBM WAS - Tomcat 7 - Primefaces 3.0 - JFS 2.1

7specialgems
Posts: 6
Joined: 19 Apr 2012, 15:32

19 Apr 2012, 15:34

Works with Primefaces 3.2.

With Primefaces 3.1.1, I needed to put the growl in its own form!

Bit of a gotcha: Users of Spring Roo will find version 3.1.1 of Primefaces being put into their POM when using "web jsf setup".

:geek:

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests