【发布时间】:2012-12-11 11:39:56
【问题描述】:
这段代码总是抛出 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>
有什么诀窍吗? 会话存储在服务器中
【问题讨论】:
-
尝试将
private static final long serialVersionUID = ...添加到你的bean中...(你最好在JSF中使用<h:body>而不是),也可以试试<context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param>? -
与 serialVersionUID 相同的异常,
client 是解决方案,但我正在尝试使用server 跨度> -
@mulax 你的 appengine-web.xml 中有
<sessions-enabled>true</sessions-enabled>吗?还有,你用的是什么GAE SDK?
标签: java google-app-engine jsf-2