This content has been marked as final.
Show 5 replies
-
1. Re: fileUpload: nothing happens
sen.cool Sep 2, 2008 1:38 AM (in response to hlamprecht)Can u show your code ?
-
2. Re: fileUpload: nothing happens
hlamprecht Sep 2, 2008 6:00 AM (in response to hlamprecht)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
sen.cool Sep 2, 2008 6:31 AM (in response to hlamprecht)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
hlamprecht Sep 2, 2008 7:47 AM (in response to hlamprecht)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
hlamprecht Sep 3, 2008 3:33 AM (in response to hlamprecht)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