0

我必须维护一个基于 JSF 1.1 和 Ajax4JSF 的现有企业 Web 应用程序。我想使用<a4j:support>. 它归结为以下代码片段:

<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="http://java.sun.com/jsf/html"                   prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core"                   prefix="f"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax"             prefix="a4j"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Validate Test</title>
</head>
<body>
<f:view>
       <h:form>
            <h:inputText value="42" id="fooInput" required="true">
                <a4j:support event="onchange" reRender="fooMsg" immediate="true" ajaxSingle="true"/>
                <f:validateDoubleRange minimum="10" maximum="500"/>
            </h:inputText>
            <h:message for="fooInput" id="fooMsg" style="color: red;"/><br/>
            <h:inputText value="Bar" id="barInput">
            </h:inputText>
        </h:form>
</f:view>
</body>
</html>

但是 Ajax 请求不会被触发。抛出以下 JS 错误:

TypeError: element.selectNodes is not a function 
    at Object.A4J.AJAX.XMLHttpRequest.getElementsByTagName (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:32:19)
    at Object.A4J.AJAX.XMLHttpRequest._appendNewElements (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:43:389)
    at Object.A4J.AJAX.XMLHttpRequest.appendNewHeadElements (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:43:185) 
    at Object.A4J.AJAX.processResponse [as onready] (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:57:731) 
    at XMLHttpRequest._request.onreadystatechange (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:20:25)

我还尝试更改“立即”和“ajaxSingle”属性,但它没有改变任何东西。Ajax 请求不会被触发。Web 应用程序中的其他 Ajax4JSF 功能似乎可以工作。问题是什么,我该如何解决?

4

0 回答 0