WildFly自动重新部署应用程序后的ViewExpiredException

时间:2016-11-06 19:52:11

标签: ajax jsf jsf-2 wildfly

我刚刚使用JSF Ajax - 我遇到了一个问题:

部署JsfApplication.war后,一切正常,应用程序按预期工作。过了一会儿,WildFly - 服务器重新部署了我的JsfApplication.war,然后我的html - 网站上了ViewExpiredException。 只有当我删除服务器上的JsfApplication.war并自行重新部署时,才能摆脱这个问题。我正在使用WildFly 9.0.2.Final

这里发生了什么?

这就是我的HTML:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>SecondView</title>
</h:head>

<h:body>
    <h:outputText value="Hallo SecondView!" style="font-weight:bold" />
    <h:form id="a">
        <h:outputText id="a1" value="#{someBean.name1}" />
        <h:outputText id="a2" value="#{someBean.name2}" />
        <h:commandButton value="button1" action="#{someBean.doSecond}">
            <f:ajax render="@form" />
        </h:commandButton>
    </h:form>
    <h:form id="b">
    <f:ajax event="valueChange" execute=":b:b1" render=":b:b1 :a:a1" listener="#{ajaxDemoModel.logAjaxBehaviourEvent}">
            <h:inputText id="b1" value="#{someBean.name1}" />
            <h:commandButton value="button2" action="#{someBean.doSecond}">
                <f:ajax execute=":b:b1" render=":b:b1 :a:a1"/>
            </h:commandButton>
        </f:ajax>
    </h:form>
</h:body>

</html>

这是我的Somebean:

@Model
public class SomeBean {

    private String name1 = "test1";
    private String name2 = "test2";

    public String getName1() {
        return name1;
    }

    public void setName1(String name1) {
        this.name1 = name1;
    }


    public String doSecond() {
        return "secondView";
    }

    public String getName2() {
        return name2;
    }

    public void setName2(String name2) {
        this.name2 = name2;
    }

}

这是我的faces-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
    <navigation-rule>
    <from-view-id>/secondView.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>/SecondView</from-outcome>
        <to-view-id>secondView.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
    </navigation-rule>
</faces-config>

0 个答案:

没有答案