2014年10月1日 星期三

Richfaces 3.3.2 : file upload failed in IE11

Status :
       transfererror happen
Exception :
       Caused by: java.lang.NullPointerException at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:138)

Trace :
  1. source code :
  134   MultipartRequest multipartRequest = MultipartRequest.lookupRequest(context, uid);
  135     
  136   boolean isFlash = (requestParameterMap.get("_richfaces_send_http_error") != null);
  137   
  138   List<UploadItem> fileList = multipartRequest.getUploadItems();

   2. html :  (F12 : Developer tool)
       a. RichFaces Live Demo : work fine <h:form> ...... </h:form>
              <form name="j_id353" id="j_id353" action="/richfaces-demo/richfaces
                /fileUpload.jsf;jsessionid=8FCE14B6E3145970C161C54903BCEBDB"
                enctype="application/x-www-form-urlencoded" method="post">
              .....
             </form>       

      b. my page : not work :  <a4j:form id="uploadForm"> ...... </a4j:form>
             <form name="uploadForm" id="uploadForm" action="/mh/a/admin/home.fcs"
               method="post" target="">
             .....
            </form>

Solution :  <a4j:form> does not add "enctype" attribute automatically .
       The following 3 methods can solve this problem:
         *  uses  <h:form>
         *  uses  <h:form enctype="multipart/form-data">
         *  uses  <a4j:form enctype="multipart/form-data">

沒有留言:

張貼留言