Bonjour,
Je suis en train de développer une application web avec JSF (Richfaces) + Spring + Hibernate.
En premier lieu, lors de déploiment sous Tomcat, j'ai bien la liste des chauffeurs que je désire avoir mais après, en sélectionnant une ligne et en cliquant sur le bouton Detail, j'ai ça :
Sachant que le bouton détail va m'amener à la page Chauffeurdetail.jsp.
Voici mon faces-config.xml :
mon 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
16
17
18
19
20
21
22
23
24
25 <?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_1_2.xsd" version="1.2"> <application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> </application> <navigation-rule> <from-view-id>*</from-view-id> <navigation-case> <from-outcome>detail</from-outcome> <to-view-id>/Chauffeurdetail.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>List</from-outcome> <to-view-id>/ChauffeurList.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config>
ChauffeurBean.java
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 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>wise</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <!-- chargement du spring !! --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:application-context.xml</param-value> </context-param> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> <filter> <filter-name>RichFaces filter</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>RichFaces filter</filter-name> <servlet-name> Faces Servlet</servlet-name> </filter-mapping> </web-app>
Quelqu'un saurait-il m'expliquer d'où peut venir le problème ?
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 package org.wisetech.geoloc.Web; import java.io.Serializable; import java.util.Iterator; import java.util.List; import javax.annotation.PostConstruct; import org.richfaces.component.html.HtmlScrollableDataTable; import org.richfaces.model.ScrollableTableDataModel.SimpleRowKey; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import org.wisetech.geoloc.model.Chauffeur; import org.wisetech.geoloc.service.ChauffeurService; @Component("chauffeurBean") @Scope("session") public class ChauffeurBean implements Serializable{ @Autowired private transient ChauffeurService chauffeurService; private transient HtmlScrollableDataTable chauffeurTable; private List<Chauffeur> chauffeurList; private Chauffeur currentChauffeur=new Chauffeur(); @PostConstruct public void init(){ chauffeurList = chauffeurService.findAll(); } public String viewNew(){ currentChauffeur = new Chauffeur(); return "detail"; } public String viewDetail(){ List<Chauffeur> valueList = (List<Chauffeur>) chauffeurTable.getValue(); Iterator<SimpleRowKey> keys =chauffeurTable.getSelection().getKeys(); if(keys.hasNext()){ currentChauffeur = valueList.get(keys.next().intValue()); return "detail"; } else { return null; } } public String update(){ chauffeurService.save(currentChauffeur); init(); return null; } public String delete(){ chauffeurService.delete(currentChauffeur); init(); return null; } public HtmlScrollableDataTable getChauffeurTable() { return chauffeurTable; } public void setChauffeurTable(HtmlScrollableDataTable chauffeurTable) { this.chauffeurTable = chauffeurTable; } public List<Chauffeur> getChauffeurList() { return chauffeurList; } public void setChauffeurList(List<Chauffeur> chauffeurList) { this.chauffeurList = chauffeurList; } public Chauffeur getCurrentChauffeur() { return currentChauffeur; } public void setCurrentChauffeur(Chauffeur currentChauffeur) { this.currentChauffeur = currentChauffeur; } }
Merci d'avance pour votre aide.
Partager