@ViewScoped在开发模式下工作,但不在生产模式下工作

问题描述 投票:1回答:1

这段代码总是抛出ViewExpiredException

@ManagedBean(name = "test")
@ViewScoped
public class test implements Serializable{

    private int count;

    public int getCount() {
        return count;
    }

    public void increment() {
        count++;
    }
}

和xhtml:

<body>
    <h:form>
        <h:panelGrid columns="2" cellpadding="5">
            <h:outputText value="Counter: " />
            <h:outputText value="#{test.count}" />
        </h:panelGrid>
        <h:commandButton value="Count" action="#{test.increment}" update="@form" />
    </h:form>
</body>

有一些把戏吗? 会话存储在服务器中

java google-app-engine jsf-2
1个回答
0
投票

取决于您的GAE SDK版本...但是至少对于较旧的版本,必须将javax.faces.STATE_SAVING_METHOD设置为client因为GAE不支持将其设置为session

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>
© www.soinside.com 2019 - 2024. All rights reserved.