微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

IE 9上的JSF 2 Ajax请求失败

我最近尝试在IE9上测试我的JSF应用程序并发现所有Ajax请求失败,并且在尝试访问removeChild属性时抱怨Malformed XML异常抱怨未定义的对象.我观察了MyFaces 2.0.5和mojarra 2.1.1的问题.是否有任何已知的限制或先决条件来支持IE 9?

为了重现这个问题,我把它钉在一个一个ajax请求组成的简单测试用例中:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html">
    <f:view  contentType="text/html">
    <h:head>
        <h:outputScript name="jsf.js" library="javax.faces" target="head"/>    
    </h:head>
    <h:body>
        <h:form id="#{testBean.idForm}">
                <h1>Test of IE9 Ajax</h1>
                <h:panelGroup id="#{testBean.idDiv}" layout="block">
                    Text: <h:outputText value="#{testBean.text}"/>
                    <br/>
                    <h:commandLink 
                        action="#{testBean.onAction}"
                        value="click me">
                        <f:ajax render="#{testBean.idDiv}"/>
                    </h:commandLink>
                </h:panelGroup>
            </h:form>
        </h:body>
    </f:view>
</html>

豆是

package ietest;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class TestBean {
        private int clickCount;   
        private String idForm="testForm";
        private String idDiv="testDiv";

        public String getText(){
        String text = "you clicked " + clickCount +" times";
        System.out.println("Return text " + text);
        return text;
    }

    public String onAction(){
        System.out.println("onAction invoked");
        clickCount++;
        return "iebug";
    }

    public String getIdDiv() {
        return idDiv;
    }

    public String getIdForm() {
        return idForm;
    }
}

解决方法

看起来像Mojarra问题 JAVASERVERFACES-1981.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐