2014年10月3日 星期五

Richfaces 3.3.2 : ajax /rerender partially not full support in IE11

Status :
    partial rerendering is abnormal for h:inputTextarea, rich:modalPanel, and rich:calendar.
    The following is an image of abnormal h:inputTextarea ,
Reason : Richfaces 3.3.2 ajax not support IE11 because of User-agent string changes 
                  (使用者代理字串變更)

Solution : modifies AJAX.js in the richfaces-impl-3.3.2.GA.jar ,

      step 1 : Patching RichFaces 3.3.3 AJAX.js for IE9 
                    I did the same step to Richfaces 3.3.2 , and it works fine.


     step 2 : adds ie11 checking to Sarissa._SARISSA_IS_IE and Sarissa._SARISSA_IS_IE9 :

Sarissa._SARISSA_IS_IE = (document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1) || (navigator.userAgent.toLowerCase().indexOf("like gecko") > -1 && navigator.userAgent.toLowerCase().indexOf("11.") > -1);

Sarissa._SARISSA_IS_IE9 = Sarissa._SARISSA_IS_IE && (parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5))) >= 9 || (navigator.userAgent.toLowerCase().indexOf("like gecko") > -1 && navigator.userAgent.toLowerCase().indexOf("11.") > -1);

Reference :
    http://ruleoftech.com/2013/patching-richfaces-3-3-3-ajax-js-for-ie9
    https://issues.jboss.org/browse/RF-13443


jQuery conflicts with Richfaces's modal panel -- rich:modalPanel, rich:calendar

Status :
    While the jQuery added to a page, rich:modalPanel and rich:calendar do not work.

Solution : run jQuery.noConflict
     
     <script type="text/javascript" src="scripts/jquery-1.5.1.min.js">
     </script> 
     <script type="text/javascript">
           jQuery.noConflict();
     </script>

Reference : 
http://forum.jquery.com/topic/problem-with-jquery-1-5-2-min-js-and-jsf-rich-modalpanel 


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">