0
我試着理解爲什麼我在簡單的webapp上得到一個javax ViewExpiredException - 但我似乎無法理解是什麼導致視圖過期。Javax ViewExpired拋出POST後發生的異常
這是register.jsf:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
template="pageTemplate.xhtml">
<ui:define name="content">
<b:panel title="Registrierung" look="primary">
<h:form>
<h:panelGrid>
<h:outputText value="Name:"/>
<b:inputText value="#{registerController.user.name}" placeholder="Robina Kuh"/>
<h:outputText value="E-Mail:"/>
<b:inputText value="#{registerController.user.email}" placeholder="[email protected]" size="32">
<f:facet name="prepend">
<h:outputText value="@" />
</f:facet>
</b:inputText>
<b:commandButton value="Registrieren" icon="envelope" action="#{registerController.registerUser}"/>
</h:panelGrid>
</h:form>
</b:panel>
</ui:define>
</ui:composition>
模板:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Lunch</title>
</h:head>
<h:body style="padding: 60px;">
<ui:include src="topMenu.xhtml" />
<ui:insert name="content">
<b:container>
<b:jumbotron>
<h1>Da ist wohl etwas schiefgelaufen... Sorry!</h1>
</b:jumbotron>
</b:container>
</ui:insert>
</h:body>
</html>
這是控制器:
@Named("registerController")
@SessionScoped
public class RegisterController implements Serializable {
@Inject
private UserManager userManager;
private User user;
private Logger logger = Logger.getLogger(RegisterController.class);
public RegisterController() {
logger.debug("Created RegisterController");
user = new User();
if(user != null)
logger.debug("Name: " + user.getName()
+"\nEmail: " + user.getEmail());
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String registerUser() {
logger.debug("registerUser called"
+ "\n Name: " + user.getName()
+"\nEmail: " + user.getEmail());
userManager.addUser(user);
logger.debug("registerUser end");
return "benutzer.jsf";
}
}
它甚至沒有進入的操作方法,我當我嘗試調試它時commandButton(我正在使用Bootsfaces框架,但我不認爲這與此有任何關係在框架)。
將保存狀態設置爲客戶端工作,但我想明白是什麼問題?從我對JSF的理解來看,這應該不會將狀態推向客戶端。 我錯過了一些基本的東西嗎?
我將webapp部署到widlfly 9服務器。
這是可以接受的愚蠢? http://stackoverflow.com/questions/25880031/viewexpiredexception-on-a-wildfly-served-webapp-only-in-a-particular-webbrowser/ – BalusC
嗨Bauke,我已閱讀這些和一些其他的解釋,但我仍然不不瞭解什麼會導致過期 – Stefan
嗯,這裏有更多的食物供您閱讀:http://stackoverflow.com/q/3106452和http://stackoverflow.com/q/3642919 – BalusC