【发布时间】:2014-09-02 09:59:44
【问题描述】:
我有一个按钮。如果按下此按钮,则应呈现一个复选框。
这当然工作得很好。该复选框应该在更改时调用一个函数,该函数应该只是 System.out.println() 一些东西,所以我看到它被调用了。
问题是:只是简单的复选框功能,没有重新渲染效果很好。但是一旦a4j:support 被重新渲染,它就不起作用了,System.out.println() 永远不会被调用
这看起来很简单,但我不知道为什么它根本不起作用!
任何提示/技巧?
这是旧环境,因此仅限 JSF 1.2。
我的 xhtml
<s:div id="sdBoolCheckboxtest">
#{testController.testRerenderBool}
<s:div id="sdRerender" rendered="#{testController.testRerenderBool}">
<h:selectBooleanCheckbox id="myscheckbox" value="#{testController.testBool}">
<a4j:support ajaxSingle="true" event="onclick" immediate="true"
status="globalStatus" action="#{testController.testCheckbox()}" />
</h:selectBooleanCheckbox>
</s:div>
</s:div>
</h:form>
我的 Java 类:
@Name("testController")
@AutoCreate
public class TestController {
private boolean testBool = false;
public boolean isTestRerenderBool() {
return testRerenderBool;
}
public void setTestRerenderBool(boolean testRerenderBool) {
this.testRerenderBool = testRerenderBool;
}
private boolean testRerenderBool;
public void switchtestRerenderBool(){
System.out.println("switch");
testRerenderBool = !testRerenderBool;
}
public void testCheckbox(){
System.out.println("drin");
}
public boolean isTestBool() {
return testBool;
}
public void setTestBool(boolean testBool) {
this.testBool = testBool;
}
}
【问题讨论】:
标签: jsf richfaces jsf-1.2 ajax4jsf