2013-03-31 1 views
0

JSF 2.2로 파일 업로드 양식을 만들려고합니다. 이 양식에서는 손실 초점 때 서버에 아약스 할 bankCode 입력 상자가 있습니다. 또한이 양식에는 입력 파일 상자가 들어 있습니다. 그래서 업로드 파일을위한 h : form 태그에 enctype = "multipart/form-data"속성을 넣어야합니다.JSF 2.2 - 다중 파트/양식 데이터가있는 양식의 아약은 약간의 오류가 있습니다.

언제든지 양식에 enctype을 입력합니다. Chrome 디버거에 ajax가 오류 메시지를 표시합니다.

Uncaught TypeError: Cannot read property 'length' of null
jsf.js.htm:359

예제 코드

<h:form id="dialogForm" prependId="false" enctype="multipart/form-data"> 
     <h:commandLink action="#{bankController.initCreate()}" class="btn add" style="margin: 10px 0 20px 20px;"> 
      <f:ajax immediate="true" execute="@this" render=":dialogForm"/> 
      <span>Add new bank</span> 
     </h:commandLink> 
     <table class="dialogTable" style="margin: 10px 0 20px 20px;"> 
      <colgroup> 
       <col width="30%"/> 
       <col width="70%"/> 
      </colgroup> 
      <tr> 
       <td class="label"> 
        <label for="abbreviation">Bank's code<span class="required">*</span></label> 
       </td> 
       <td>           
        <h:panelGroup id="codeBox" layout="block" class="codeBox"> 
         <h:inputText id="code" value="#{bankController.curBank.code}" maxlength="10" class="input code #{bankController.isExistCode?'error':''}" 
            onblur="return validTextInput('code',2);"> 
         <f:validateLength minimum="2" maximum="10"/> 
          <f:ajax execute="@this" event="blur" listener="#{bankController.existCode()}" onevent="function(e){showValidateIcon(e, 'code');}" render="codeBox"/> 
         </h:inputText> 
         <span class="append2"> 
          <img id="codeXLoad" src="#{cdnLocator.officeUrl}/img/load16.gif" title="On process, please wait" width="16" height="16" style="margin-top: 2px; display: none;"/> 
          <img id="codeXWarn" src="#{cdnLocator.officeUrl}/css/images/error_msg_icon.gif" title="Not allowed" width="16" height="16" style="margin-top: 2px; #{bankController.isExistCode?'':'display: none;'}"/> 
          <img id="codeXAvai" src="#{cdnLocator.officeUrl}/css/images/success_msg_icon.gif" title="Allowed" width="16" height="16" style="margin-top: 2px; #{bankController.isExistCode?'display: none;':''}"/> 
         </span> 
        </h:panelGroup> 
       </td> 
      </tr> 
      <tr> 
       <td class="label"> 
        <label for="icon">Bank icon file*</label> 
       </td> 
       <td> 
        <h:inputFile id="bankIconFile" value="#{bankController.bankIconFile}"/> 
       </td> 
      </tr> 
     </table> 
    </h:form> 

어떻게이 오류를 해결할 수 있습니다.

+0

문제점은 내가 볼 수있는 여러 잠재적 문제와 관련이있을 수 있습니다. 'onblur' 자바 스크립트는'blur' ajax 이벤트 전에 실행되지 않았거나'validateTextInput' 자바 스크립트 함수에 코드 문제가있을 수 있습니다. Javascript 코드를 보면 더 많은 정보를 얻을 수 있습니다. –

+0

JSF 2.2가 공식적으로 출시 되었습니까? 그것이 없다면 버그를 예상해야합니다 – kolossus

답변

0

답장을 보내 주셔서 감사합니다. JSF 2.2 M10에서 M12 로의 버그입니다. JSF 2.2 M9로 변경하면 잘 작동합니다.

그래서 JSF 2.2가 릴리스 될 때까지 M9를 사용합니다.

+0

신고 해 주셨습니까? 그렇지 않다면, 최종 배포본에 나오지 않을 것입니다. 그렇다면 보고서 링크를 게시하십시오. – BalusC

+0

gassfish4와 함께 제공되는 JSF 2.2 릴리스 버전에서이 오류를 발견했습니다. 나는 몇 주 동안 Google에 노력했지만 아직 해결책을 찾지 못했습니다. 저를 고칠 방법을 제안 해주십시오. –

0

Mojarra으로 버그를 제기했으며 귀하의 문제와 관련이 있다고 생각합니다.

Stackoverflow issue

PS. Jira에게 투표하면 5 월 14 일부터 휴면 상태가되므로 해결 속도가 빨라질 수 있습니다.