0

JSF 2.2でアップロードファイルフォームを作成しようとしています。このフォームには、フォーカスを失ったときにサーバーに ajax する bankCode 入力ボックスがあります。また、このフォームには入力ファイルボックスも含まれています。SO アップロード ファイルの h:form タグに enctype="multipart/form-data" 属性を配置する必要があります。

enctype をフォームに入れるたびに、Ajax は Chrome のデバッガーにエラー メッセージを表示します。


キャッチされていない TypeError: 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>

このエラーを修正するにはどうすればよいですか。

4

2 に答える 2

0

返信ありがとうございます。これは JSF 2.2 M10 から M12 のバグであることがわかりました。JSF 2.2 M9 に変更しましたが、うまく動作します。

なので、JSF 2.2 がリリースされるまでは M9 を使います。

于 2013-04-06T02:14:16.170 に答える