アプリケーションを作成しているときに、ページ Bean が @FlowScoped に保存されませんでした。デフォルトでは、私のコードの Request スコープに格納されています:
enter code here
package com.webage.beans;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.flow.FlowScoped;
@ManagedBean(name="flow1")
@FlowScoped(value = "flow1")
public class Flow1Bean implements Serializable {
public String cusName;
public String city;
public String getName() {
return this.getClass().getSimpleName();
}
public String doReturnValue() {
return "return1";
}
/**
* @return the cusName
*/
public String getCusName() {
return cusName;
}
/**
* @param cusName the cusName to set
*/
public void setCusName(String cusName) {
this.cusName = cusName;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
}
ここにある私の Xhtml ファイルは、ページから入力を取得し、それをページ Bean に保存しています。
<p>
<span id="param1FromFlow1">Flow bean
param1Value:<h:inputText id="input"
value="#{flow1.cusName}" /> </span>
</p>
<h:outputText value="#{null != facesContext.application.flowHandler.currentFlow}" >
</h:outputText>
<p></p>
<h:commandButton type="submit" value="Next" styleClass="commandButton"
id="button1" action="flow1a"></h:commandButton>
<p></p>
以下のコードは、flow/flow1.xhtml ファイルで「false」を返します。
<h:outputText value="#{null != facesContext.application.flowHandler.currentFlow}" >
</h:outputText>