5 Replies Latest reply on Mar 12, 2009 10:21 AM by mazz

    file upload and form parameters

    mazz

      I have an xhtml page whose URL requires an "id" paramter (http://foo/mypage.xhtml?id=123). Some parts of my page need this id to render things.

      I also have a very simple rich:fileUpload component on my .xhtml page:

      <rich:fileUpload
       id="contentUpload"
       fileUploadListener="#{UploadNewPackageUIBean.fileUploadListener}"
       listHeight="60px"
       maxFilesQuantity="1"
       immediateUpload="false"
       autoclear="false"
       allowFlash="false">
      </rich:fileUpload>


      It is working. I can see my file get stored in my temp directory and I see my fileUploadListener get called and it finishes successfully. The file upload works fine.

      However, it seems that my entire page gets refreshed asynchronously to the call to the file upload listener, which causes a JSF error page to display in my browser. The error that is causing this is the fact that my page requires an "id" parameter to be passed in but whatever the file upload component is doing to request a refresh is not passing in the id parameter that did exist at the time I first viewed my page (does this file upload component build its own internal form that is used to submit something?)

      Any ideas how I can force the file upload component to inject required parameters when it requests a page refresh?

        • 1. Re: file upload and form parameters
          mazz

          BTW: I don't even need this page to re-render. I'd be happy if the file upload component just uploaded the content and didn't touch the page (i.e. I do not need this page to refresh itself).

          • 2. Re: file upload and form parameters

            Hi,

            The error caused by id parameter that fileupload component sends on each upload for internal purpose. See https://jira.jboss.org/jira/browse/RF-5960.

            Before it wil be fixed you should keep in mind that unexpected id can be sent to server by upload component. Also, you can rename your id parameter to fix the problem.

            • 3. Re: file upload and form parameters
              mazz

              You mean rich faces uses its own parameter called "id" and therefore does not allow any user applications to use "id" as a parameter name?

              I would suggest the RichFaces impl be changed - "id" seems to me to be a very common parameter name almost every medium to large UI project would want to use. Rich Faces should try to avoid clashing with known or common names (perhaps use __id).

              We have "id" all over the place and its used in common, resuable components so its not easy for me to change this one page's use of "id" - it would require my entire app to change :-(

              • 4. Re: file upload and form parameters

                Yes.

                You right that this is a very common parameter. We need to rename it.
                Please wait for the issue will be fixed.

                • 5. Re: file upload and form parameters
                  mazz

                  Can you give me some pointers as to what file(s) I would need to change if I were to fix this myself? This is causing a bit more headache for me than I would like, so at a minimum I want to patch my own copy of RichFaces myself. If its easy enough, I could contribute the patch back.