Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf Ajax更新无效,Firefox错误:XML或文本声明不在实体的开头_Jsf_Primefaces - Fatal编程技术网

Jsf Ajax更新无效,Firefox错误:XML或文本声明不在实体的开头

Jsf Ajax更新无效,Firefox错误:XML或文本声明不在实体的开头,jsf,primefaces,Jsf,Primefaces,我有一个小表单,它将从一个类接收值。但是,按下按钮不会更新SelectOne菜单 刷新表单将正确地用正确的项目填充菜单 我期待着 update="instrument"/> 刷新菜单的内容。但我想我错过了什么。注意,bean中的方法在按下按钮时被调用。在选择项目时,将填充列表,并设置int <h:form id="listForm"> <p:outputLabel for="instrument" value="Instrument " /&g

我有一个小表单,它将从一个类接收值。但是,按下按钮不会更新SelectOne菜单

刷新表单将正确地用正确的项目填充菜单

我期待着

update="instrument"/>
刷新菜单的内容。但我想我错过了什么。注意,bean中的方法在按下按钮时被调用。在选择项目时,将填充列表,并设置int

<h:form id="listForm">

            <p:outputLabel for="instrument" value="Instrument " />
            <p:selectOneMenu id="instrument" value="#{tradeFactory.intInstrumentID}" style="width:150px">
                <p:ajax listener="#{tradeFactory.onInstrumentChange(tradeFactory.intInstrumentID)}" update="instrument" />
                <f:selectItem itemLabel="Select Instrument" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{tradeFactory.instrumentID}" />
            </p:selectOneMenu>
            <p:commandButton value="Update" actionListener="#{tradeFactory.getInstrumentIDs()}" update="instrument"/>
马文波姆

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.9</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.9</version>
</dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.3.1</version>
</dependency>
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.6</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.2.10</version>
</dependency>
<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>5.2</version>
</dependency>

org.glassfish.jersey.core
泽西岛客户
2.9
org.glassfish.jersey.media
泽西媒体公司
2.9
com.google.code.gson
格森
2.3.1
乔达时间
乔达时间
2.6
javax.servlet
jstl
1.2
com.sun.faces
JSFAPI
2.2.10
org.primefaces
素面
5.2

ajax更新失败是由ajax响应中的双XML序言引起的:

<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='UTF-8'?>

确保您同时删除了
jsfapi
jsf impl
坐标。

@PostConstruct
引入了一个好的红鲱鱼。要排除一个和另一个,ajax响应是什么样子的?(在浏览器中按F12并打开网络选项卡)它是否包含更新的菜单?浏览器控制台中是否存在JS错误?(在浏览器中按F12并打开控制台选项卡)添加了网络选项卡。如果您使用的是Chrome,控制台是空的。我要求的是ajax响应,而不是启动器。单击“名称”列(最左侧)中的ajax请求,然后打开右侧部分中的“响应”选项卡。你只需要知道它是否包含更新的菜单,而不是复制粘贴整个内容。当我单击request.send时,会自动打开一个选项卡,但这只是加载数据。这就是你想要的吗?更新过的菜单在那里吗?(当然,作为一名web开发人员,您必须能够阅读纯HTML代码)了解这一点很重要,这样我们才能找出问题的原因。
15:18:52.737 XML or text declaration not at start of entity1 trades.xhtml:2:1
<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.9</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.9</version>
</dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.3.1</version>
</dependency>
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.6</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.2.10</version>
</dependency>
<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>5.2</version>
</dependency>
<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='UTF-8'?>
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.faces</artifactId>
    <version>2.2.11</version>
</dependency>