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>

有什么诀窍吗?会话存储在服务器中

4

1 回答 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>
于 2012-12-11T12:54:55.130 回答