【问题标题】:Page Bean not saved in FlowScope Jsf 2.2Page Bean 未保存在 FlowScope Jsf 2.2 中
【发布时间】:2014-02-14 06:20:05
【问题描述】:

当我创建一个应用程序时,我的页面 bean 没有保存在 @FlowScoped 中。默认情况下,我的代码存储在请求范围内:

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>

【问题讨论】:

    标签: jsf jsf-2.2 websphere-8 flow-scope


    【解决方案1】:

    Flowscope 是 CDI 范围。使用@Named 而不是@ManagedBean

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 2018-01-08
      • 2013-09-02
      • 2015-02-11
      • 2016-12-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多