wood burning stoves 2.0*
The moose likes JSF and the fly likes upload file jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "upload file jsf" Watch "upload file jsf" New topic
Author

upload file jsf

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
I am trying to upload a file using primefaces the code is the next one:

<p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
allowTypes="*.jpg;*.png;*.gif;" description="Images"/>

FileUploadController.java
------------------------

public class FileUploadController {

private Logger logger = LoggerFactory.getLogger(FileUploadController.class);

public void handleFileUpload(FileUploadEvent event) {
logger.info("Uploaded: {}", event.getFile().getFileName());

FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}


┬┐is it right or it incorrect?

Thanks
 
jQuery in Action, 2nd edition
 
subject: upload file jsf
 
Similar Threads
display message when page is first displayed
Upload
primefaces fileupload doesn't work
calling back bean
problem uploading .xls file