ViewScope モードの Managed Bean があります。そのため、このマネージド Bean から何らかのアクションを呼び出すと、ページが更新されません。アクションが適切に呼び出され、null が返されることがわかります (viewscope ワークフローは問題ありません)。
それで、私は何を間違っていますか?
Ajax を使用してページを再レンダリングすると、正常に動作します。
編集:
私のバージョンは次のとおりです。
JSF 2.1.14 と Primefaces 3.4.1
私のコード:
@ManagedBean(name = "test")
@ViewScoped
public class TestMB implements Serializable {
private String status;
public String getStatus() { return this.status; }
public void setStatus(String status) { this.status = status; }
public String changeStatus() {
this.status = "ViewScope Works!";
return null;
}
}
マイページ:
<!DOCTYPE HTML>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/template/ui.xhtml">
<ui:define name="head">
</ui:define>
<ui:define id="teste" name="content">
<h:form id="form">
<h:outputText id="status" value="OK?: #{test.status}" />
<p:commandButton id="myAction" value="Do it!" action="#{test.changeStatus}" />
</h:form>
</ui:define>
</ui:composition>
私の画面では、ステータス変数は変わりません。そして、はい.. アクションは OK と呼ばれます。いくつかのヒント?