seam 2.1, richfaces 3.2.0 and fileUpload
koatto Apr 5, 2008 9:26 AMi'm using richfaces 3.2.0 and seam 2.1 and im facing problems on getting rich:fileUpload work. It seems the component can't find the listener method.
this is what i get :
|Caused by: javax.faces.el.MethodNotFoundException: /test.xhtml @17,112 fileUploadListener="#{uploadHandler.fil
eUploadListener}": Method not found: mk.common.UploadHandler@1af0d15.fileUploadListener(org.richfaces.event.Up
loadEvent)
at ||com.sun.facelets.el.LegacyMeth||odBinding.invoke(LegacyMethodBinding.java:71)
at org.richfaces.component.UIFileUpload.broadcast(UIFileUpload.java:160)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:289)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:404)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
... 41 more|this is my component's code :
import java.io.File;
import java.io.IOException;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
import org.richfaces.model.UploadItem;
@Name("uploadHandler")
public class UploadHandler {
@Logger
Log log;
public void fileUploadListener(org.richfaces.event.UploadEvent event) {
if(event==null){
log.debug("null upload event");
return;
}
UploadItem item = event.getUploadItem();
String name = "unnamed_attachment";
byte[] data = item.getData();
if (item.isFile()) {
name = item.getFileName();
data = item.getData();
File file = item.getFile();
log.debug(
"uploaded "+name+
" - length= "+( (data==null)?0:data.length) +
" tmpFile="+file.getAbsoluteFile()
);
}
}
}and that's my page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:rich="http://richfaces.org/rich" >
<HEAD>
<title>test fileupload</title>
</HEAD>
<body>
<h:form>
<rich:fileUpload id="upload" fileUploadListener="#{uploadHandler.fileUploadListener}" maxFilesQuantity="2">
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}" />
</f:facet>
</rich:fileUpload>
</h:form>
</body>
</html>If i remove the event parameter from the listener methd it gets recognized and the page works, but i obviously have no access to anything.
I think the seam's el handler is producing some bad effect.
Thanks.