此代码始终抛出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>
有些技巧吗?
会话存储在服务器中
答案 0 :(得分: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>