Java JSF2.2-带有多部分/表单数据的表单中的ajax有一些错误
我尝试用JSF2.2创建上传文件表单。 在这个表单中,我有一个银行代码输入框,当失去焦点时,它会将ajax发送到服务器。 此表单还包含带有的输入文件框。所以我必须将enctype=“multipart/form data”属性添加到上传文件的h:form标记中 每次我将enctype放入表单时,ajax都会在Chrome的调试程序中显示错误消息 未捕获的TypeError:无法读取null的属性“length”Java JSF2.2-带有多部分/表单数据的表单中的ajax有一些错误,java,jsf,jsf-2.2,Java,Jsf,Jsf 2.2,我尝试用JSF2.2创建上传文件表单。 在这个表单中,我有一个银行代码输入框,当失去焦点时,它会将ajax发送到服务器。 此表单还包含带有的输入文件框。所以我必须将enctype=“multipart/form data”属性添加到上传文件的h:form标记中 每次我将enctype放入表单时,ajax都会在Chrome的调试程序中显示错误消息 未捕获的TypeError:无法读取null的属性“length” jsf.js.htm:359 示例代码 <h:form id="dialogF
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>
添加新银行
银行代码*
银行图标文件*
如何修复此错误。谢谢您的回复。
我发现这是JSF2.2M10到M12的错误。
我改为JSF2.2M9,它工作得很好
因此,在发布JSF2.2之前,我将一直使用M9。我提出了一个bug,我认为它也与您的问题有关
注:投票支持Jira可能会加快解决速度,因为它自5月14日起就处于休眠状态我看到您的问题可能与许多潜在问题有关。
onblur
javascript可能在blur
ajax事件之前未执行,或者validateextinput
javascript函数可能存在代码问题。看到Javascript的代码会告诉我们更多。JSF2.2正式发布了吗?如果它没有报告,你应该会有虫子?如果没有,它将不会在最终版本中发布。如果是这样,请发布报告链接。我在gassfish4附带的JSF2.2版本verion上仍然发现了这个错误。我试着用谷歌搜索了几个星期,但还没有找到解决办法。请告诉我怎么修。