Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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
Oracle ADF h:commandButton f:ajax不工作_Ajax_Jsf 2_Oracle Adf - Fatal编程技术网

Oracle ADF h:commandButton f:ajax不工作

Oracle ADF h:commandButton f:ajax不工作,ajax,jsf-2,oracle-adf,Ajax,Jsf 2,Oracle Adf,尝试通过Ajax更新页面。单击按钮并在页面上打印计数器 当在Tomcat7上部署JSF2.0 mojarra时,以下代码可以工作。从jdeveloper11g部署到内置Weblogic服务器时,它不起作用。count变量确实会递增,但每次使用ADF时都会重新加载页面 支持Bean: import javax.faces.bean.*; import javax.faces.event.ActionEvent; @ManagedBean(name="countBean") @Session

尝试通过Ajax更新页面。单击按钮并在页面上打印计数器

当在Tomcat7上部署JSF2.0 mojarra时,以下代码可以工作。从jdeveloper11g部署到内置Weblogic服务器时,它不起作用。count变量确实会递增,但每次使用ADF时都会重新加载页面

支持Bean:

import javax.faces.bean.*;
import javax.faces.event.ActionEvent;

@ManagedBean(name="countBean")   
@SessionScoped
public class CountBean {
    Integer count=1;
    public void incrementCount(ActionEvent event) {
        ++count;
    }
    public Integer getCount() { return count;}
    public void setCount(Integer count) {   this.count = count; }           
}
JSF页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
<h:head><title>Ajax commandButton test</title></h:head>
<h:body>
<h3>Ajax count</h3>
<h:form>
<h:commandButton id="cb" value="Increment count" 
   actionListener="#{countBean.incrementCount}">
    <f:ajax event="click" execute="cb" render="ot" />
</h:commandButton>
<br/><br/>
Counter = <h:outputText id="ot" value="#{countBean.count}"/>
</h:form>
</h:body>
</html>

Ajax命令按钮测试
Ajax计数


计数器=
我自己找到了答案:

<af:commandButton text="increment count" id="cb1" actionListener="#{countBean.incrementCount}" partialSubmit="true"/>

Counter = <af:outputText id="ot" value="#{countBean.count}" partialTriggers="cb1"/>

计数器=

我自己找到了答案:

<af:commandButton text="increment count" id="cb1" actionListener="#{countBean.incrementCount}" partialSubmit="true"/>

Counter = <af:outputText id="ot" value="#{countBean.count}" partialTriggers="cb1"/>

计数器=

在浏览器中打开页面,右键单击并查看源代码。您是否看到两台服务器的HTML源代码存在差异?我猜
jsf.js
不知何故丢失/损坏了。Firebug/Chrome应该会告诉您更多关于JS错误的信息。在浏览器中打开页面,右键单击并查看源代码。您是否看到两台服务器的HTML源代码存在差异?我猜
jsf.js
不知何故丢失/损坏了。Firebug/Chrome应该告诉您更多关于JS错误的信息。