当我创建一个应用程序时,我的页面bean没有保存在@FlowScoped中。默认情况下存储在Request scope中我的代码:
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>
答案 0 :(得分:0)
Flowscope是一个CDI范围。使用@Named
代替@ManagedBean
。