fileUpload problem - error message is not displayed
---------------------------------------------------
Key: RF-4349
URL:
https://jira.jboss.org/jira/browse/RF-4349
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.1
Environment: jsf, a4j
Reporter: Hrvoje Jo
Hi!
I would like to know is there a way to stop fileUploadListener (fileUpload component) and
diplay error message?
E.g.
I would like to upload file only if file with sam name doesn't egsist on server. It
would be nice if the validation would be on client side. So I tried to do validation
inside of fileUploadListener, but the message (<rich:messages />) is not shown,
although the upload is stopped, and message is added.
Is this a bug, or am I doing something wrong? Here is the code
public void processUpload(UploadEvent event) {
UploadItem item = event.getUploadItem();
java.io.File f = item.getFile();
fileList = getFiles();
for (File file : fileList) {
if(item.getFileName().equals(file.getName())){
FacesContext ctx = FacesContext.getCurrentInstance();
//Show message
ctx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
"error", "error"));
ctx.renderResponse();
return;
}
}
//If file doesn't egsists...
...
There is a post on forum
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=141559&a...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira