简体   繁体   中英

rich:fileUpload — Nothing happening?

I'm trying to use RichFaces <rich:fileUpload> component (with Seam as the overall framework) to upload a series of files. However, when I click the "Add" button nothing happens. Absolutely nothing. I'm not prompted with an open dialog or anything.

I have a JSF page with an , and inside of that form I have:

<rich:fileUpload allowFlash="auto" id="contentImageUpload"
immediateUpload="true" maxFilesQuantity="5"
noDuplicate="true" required="true"
uploadData="#{contentSubmissionAction.contentImages}" />

The page renders fine, but when I click the "Add" button, nothing happens. The #{contentSubmissionAction.contentImages} property is a List of UploadItem 's, so I thought that was setup properly. Has anyone seen this before? Is there something in the configuration that I could be missing that could cause this?

Is everything been put inside a <h:form> ? Have you checked the server logs for any exceptions? You may consider to play around with the source code which you can find in this demo (click View source ).

I discovered the issue that was causing this. The web theme the site was using utilized jquery and included it in the <head> . This must have conflicted with the version included with RichFaces, because once I removed it everything started working again.

In case you really need the included jquery file in the head of your web template but still would love to use your richfaces upload component, simply add this to the xhtml page:

jQuery.noConflict();

Of course that should be within script tags

It sounds very strange, but I had a broken rich:fileUpload due to the following css snippet included in my page:

input {
  width: 95%;
  passing-left: 3px;
}

Removing that or modifying that to

input[type="text"] 

for example, fixed the issue. I assume that this has got something to do with the generated

<input type="file" ... /> 

from RichFaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM