Bonjour,

Je fais une petite application simple en jsf 1.2 tiré d'un tutorial et j'obtiens l'erreur suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
javax.faces.application.ViewExpiredException: /main.jspNo saved view state could be found for the view identifier: /main.jsp
	at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88)
	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:183)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:680)
J'ai une jsp main.jsp qui affiche la liste de client et un bouton ajout de client. Lorsque j'ajoute un client et que je reviens sur ma page main, si je tri ensuite la liste (sortable de <t:datatable>) et que je fais ensuite une action (tri ou bouton ajout de client) , il me sort cette exception, il ne semble plus retrouver la vue.

définition des vues dans mon fichier web.xml :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    <navigation-rule>
<from-view-id>/main.jsp</from-view-id>
<navigation-case>
<from-outcome>goToAddCustomer</from-outcome>
<to-view-id>/addcustomer.jsp</to-view-id>
</navigation-case>
</navigation-rule>
 
<navigation-rule>
<from-view-id>/addcustomer.jsp</from-view-id>
<navigation-case>
<from-outcome>listeCustomer</from-outcome>
<to-view-id>/main.jsp</to-view-id>
</navigation-case>
</navigation-rule>
le fichier main.jsp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
 
<f:view>
    <html>
        <head>
        <link href="resources/css/table-style.css" rel="StyleSheet"/>
 
    </head>
 
    <body>
 
        <h1>JSF 1.2 + Spring + Hibernate Example</h1>
 
        <h:form>
 
        <t:dataTable value="#{customer.customerList}" binding="#{customer.datatable}" var="c"
                sortable="true" sortAscending="#{customer.sortAscending}" sortColumn="#{customer.sortColumn}"
                first="0"
                rows="10"
                id="customers"
                styleClass="order-table"
                headerClass="order-table-header"
                rowClasses="order-table-odd-row,order-table-even-row"
            >
 
            <t:column>
                <f:facet name="header">
                <t:commandSortHeader  
                columnName="customerId"  
                arrow="true"> 
                    <h:outputText value="Customer ID"/>
                    </t:commandSortHeader>
                </f:facet>
                    <t:outputText value="#{c.customerId}"/>
            </t:column>
 
            <t:column>
                <f:facet name="header">
                                <t:commandSortHeader  
                columnName="name"  
                arrow="true"> 
                <h:outputText value="Name"/>
                </t:commandSortHeader>
                </f:facet>
                <t:outputText value="#{c.name}"/>
            </t:column>
 
            <t:column>
                <f:facet name="header">
                                <t:commandSortHeader  
                columnName="address"  
                arrow="true"> 
                <h:outputText value="Address"/>
                </t:commandSortHeader>
                </f:facet>
                <t:outputText value="#{c.address}"/>
            </t:column>
 
            <t:column>
                <f:facet name="header">
                                <t:commandSortHeader  
                columnName="createdDate"  
                arrow="true"> 
                <h:outputText value="Created Date"/>
                    </t:commandSortHeader>
                </f:facet>
                <h:outputText value="#{c.createdDate}">
                 <f:convertDateTime pattern="yyyy.MM.dd HH:mm:ss"/> 
                <!--<f:convertDateTime type="date" dateStyle="full"/>-->
                </h:outputText>
 
            </t:column>
 
            <t:column>
                <f:facet name="header">
 
                <h:outputText value="Modify"/>
                </f:facet>
                <t:commandLink action="#{customer.goToModifyCustomer}" value="Modify"/>
            </t:column>
 
            <t:column>
                <f:facet name="header">
                <h:outputText value="Delete"/>
                </f:facet>
                <t:selectBooleanCheckbox binding="#{customer.checkbox}"/>
            </t:column>
 
        </t:dataTable>
 
        <t:dataScroller id="scroller" for="customers" paginator="true" fastStep="2"   
paginatorMaxPages="5"   
paginatorActiveColumnStyle="font-size:20px;font-weight:bold;"   
immediate="true">  
 
<f:facet name="first" >  
<h:outputText value="|"/>  
</f:facet>  
<f:facet name="last">  
<h:outputText value="|"/>  
</f:facet>  
<f:facet name="previous">  
<h:outputText value="|"/>  
</f:facet>  
<f:facet name="next">  
<h:outputText value="|"/>  
</f:facet>  
<f:facet name="fastforward">  
<h:outputText value=">>"/>  
</f:facet>  
<f:facet name="fastrewind">  
<h:outputText value="<<"/>  
</f:facet>  
 
</t:dataScroller>
 
            <h:commandButton value="Remove" action="#{customer.removeSelectedCustomers}"/>
            <h:commandButton value="AddCustomer" action="#{customer.goToAddCustomer}"/>
 
        </h:form>
 
    </body>
    </html>
</f:view>
Si ca peut aider, ma jsp d'accueil défini dans le web.xml est la suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Un exemple d'application JSF</title> 
</head>
<body>
    <jsp:forward page="/faces/main.jsp"/>
</body>
</html>
Je suis bloqué sur cette exception et je ne trouve pas de solution. Pour moi, ca n'a rien à voir avec le time out de la session qui serait expiré. Est ce que vous avez des pistes?