Salut je suis entrain de développer une petite application web avec icefaces jsf 1.1 tomcat 5.5 hibernate et spring.
Mon problème et que le RowSelector ne veut pas fonctionner je vous envoie mon code pour m'aider.
Merci
ça c mon Bean
Code java : 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
 
package com.sungard.beans;
 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
 
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
 
 
import com.icesoft.faces.component.ext.RowSelectorEvent;
import com.sungard.persistence.Employe;
import com.sungard.service.IEmployeService;
 
 
public class EmployeBean{
 
	Employe employee;
	private IEmployeService empServ;
	public ArrayList<Employe> employes;
	public  ArrayList<Employe> emps;
	private boolean ascending = true;
	public EmployeBean() {
		emps=new ArrayList<Employe>();
	}
	public Employe getEmployee() {
		return employee;
	}
	public void setEmployee(Employe employee) {
		this.employee = employee;
	}
	public EmployeBean(Employe employee){
		this.employee=employee;
	}
	public IEmployeService getEmpServ() {
		return empServ;
	}
	public void setEmpServ(IEmployeService empServ) {
		this.empServ = empServ;
	}
	public ArrayList<Employe> getEmployes() {
 
		if(employes==null){
			employes=new ArrayList<Employe>();
			employes = empServ.findEmployes();
		}
		if(!isAscending()){
		Collections.sort(employes, new Employe2Comparator());
		}else{
		Collections.sort(employes, new EmployeComparator());
		}
		System.out.println(employes);
		return employes;
	}
	public void setEmployes(ArrayList<Employe> employes) {
		this.employes = employes;
	}
 
	public String addBoutonAction(){
		return "JETON_CREATE";
	}	
 
	public ArrayList<Employe> getEmps() {
		return emps;
	}
	public void setEmps(ArrayList<Employe> emps) {
		this.emps = emps;
	}
	public void rowSelectionListener(RowSelectorEvent event){
 
		emps.clear();
		/*emps.addAll(employes);
		for(int i = 0; i <employes.size(); i++){
	        employee = (Employe)employes.get(i);
	        if(!employee.getSelected().booleanValue()){
	        emps.remove(employee);
	        }
	        }*/
		for(int i = 0; i <employes.size(); i++){
	        employee = (Employe)employes.get(i);
	        if(employee.getSelected().booleanValue()==true){
	        emps.add(employee);
	        }
	        }
		System.out.println(emps.size());
	}
	public boolean isAscending() {
		return ascending;
	}
	public void setAscending(boolean ascending) {
		this.ascending = ascending;
	}
 
}
Mon Entité
Code java : 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
package com.sungard.persistence;
 
 
import java.util.Date;
 
import javax.faces.model.SelectItem;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
 
 
 
@Entity
@Table(name="EMPLOYES1")
public class Employe {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	private String nom;	
	private String prenom;
	private Date date_embauche;
	private float salaire;
	private String fonction;
	private Boolean selected;
 
	public Employe() {
 
	}
 
	public int getId() {
		return id;
	}
 
	public void setId(int id) {
		this.id = id;
	}
 
	public String getNom() {
		return nom;
	}
 
	public void setNom(String nom) {
		this.nom = nom;
	}
 
	public String getPrenom() {
		return prenom;
	}
 
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}
 
	public Date getDate_embauche() {
		return date_embauche;
	}
 
	public void setDate_embauche(Date date_embauche) {
		this.date_embauche = date_embauche;
	}
 
	public float getSalaire() {
		return salaire;
	}
 
	public void setSalaire(float salaire) {
		this.salaire = salaire;
	}
 
	public String getFonction() {
		return fonction;
	}
 
	public void setFonction(String fonction) {
		this.fonction = fonction;
	}
 
	public Boolean getSelected() {
		return selected;
	}
 
	public void setSelected(Boolean selected){
		this.selected=selected;
	}
 
}
et ça c'est mon interface
Code xml : 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<f:view xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ice="http://www.icesoft.com/icefaces/component">
 
	<ice:outputDeclaration doctypeRoot="HTML"
		doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
		doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />
 
	<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
	<title>Gestion des Employes</title>
	<link href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css" />
	</head>
 
	<body>
	<h2>Gestion Des Employes</h2>
 
	<p>Ici vous pouvez ajouter, supprimer et mettre a jour tous vos
	employes</p>
	<ice:form>
 
 
		<ice:dataTable rows="5" id="Employes" var="employe"
			value="#{employeBean.employes}"
			sortAscending="#{employeBean.ascending}" >
 
			<!-- ID -->
			<ice:column >
				<ice:rowSelector value="#{employe.selected}"
					multiple="single"
					selectionListener="#{employeBean.rowSelectionListener }"
					preStyleOnSelection="true" />
				<f:facet name="header">
					<ice:commandSortHeader columnName="ID #" arrow="true">
						<ice:outputText value="ID #" />
 
					</ice:commandSortHeader>
				</f:facet>
				<ice:outputText value="#{employe.id}" />
			</ice:column>
 
			<!-- Nom -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Nom" />
				</f:facet>
				<ice:outputText value="#{employe.nom}" />
			</ice:column>
 
			<!-- Prenom  -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Prenom" />
				</f:facet>
				<ice:outputText value="#{employe.prenom}" />
			</ice:column>
 
			<!-- Date -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Date D'embauche" />
				</f:facet>
				<ice:outputText value="#{employe.date_embauche}" />
			</ice:column>
 
			<!-- Salaire -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Salaire" />
				</f:facet>
				<ice:outputText value="#{employe.salaire}" />
			</ice:column>
			<!-- Fonction -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Fonction" />
				</f:facet>
				<ice:outputText value="#{employe.fonction}" />
			</ice:column>
		</ice:dataTable>
		<ice:dataPaginator id="Data_Page" for="Employes" paginator="true"
			fastStep="3" paginatorMaxPages="4">
			<f:facet name="first">
				<ice:graphicImage url="./xmlhttp/css/xp/css-images/arrow-first.gif"
					style="border:none;" title="First Page" />
			</f:facet>
			<f:facet name="last">
				<ice:graphicImage url="./xmlhttp/css/xp/css-images/arrow-last.gif"
					style="border:none;" title="Last Page" />
			</f:facet>
			<f:facet name="previous">
				<ice:graphicImage
					url="./xmlhttp/css/xp/css-images/arrow-previous.gif"
					style="border:none;" title="Previous Page" />
			</f:facet>
			<f:facet name="next">
				<ice:graphicImage url="./xmlhttp/css/xp/css-images/arrow-next.gif"
					style="border:none;" title="Next Page" />
			</f:facet>
			<f:facet name="fastforward">
				<ice:graphicImage url="./xmlhttp/css/xp/css-images/arrow-ff.gif"
					style="border:none;" title="Fast Forward" />
			</f:facet>
			<f:facet name="fastrewind">
				<ice:graphicImage url="./xmlhttp/css/xp/css-images/arrow-fr.gif"
					style="border:none;" title="Fast Backwards" />
			</f:facet>
		</ice:dataPaginator>
		<ice:dataPaginator id="EmpPag" for="Employes" rowsCountVar="rowsCount"
			displayedRowsCountVar="displayedRowsCount"
			firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex"
			pageCountVar="pageCount" pageIndexVar="pageIndex">
			<ice:outputFormat
				value="{0} employes trouves, {1} employes affiches, du {2} au {3}. Page {4} / {5}."
				styleClass="standard">
				<f:param value="#{rowsCount}" />
				<f:param value="#{displayedRowsCount}" />
				<f:param value="#{firstRowIndex}" />
				<f:param value="#{lastRowIndex}" />
				<f:param value="#{pageIndex}" />
				<f:param value="#{pageCount}" />
			</ice:outputFormat>
		</ice:dataPaginator>
		<br>
		<ice:commandButton value="Ajout"
			action="#{employeBean.addBoutonAction}"></ice:commandButton>
		</br>
		<ice:dataTable rows="1" id="Emps" var="emp"
			value="#{employeBean.emps}">
 
			<!-- ID -->
			<ice:column>
 
				<f:facet name="header">
 
					<ice:outputText value="ID #" />
 
				</f:facet>
				<ice:outputText value="#{emp.id}" />
			</ice:column>
 
			<!-- Nom -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Nom" />
				</f:facet>
				<ice:outputText value="#{emp.nom}" />
			</ice:column>
 
			<!-- Prenom  -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Prenom" />
				</f:facet>
				<ice:outputText value="#{emp.prenom}" />
			</ice:column>
 
			<!-- Date -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Date D'embauche" />
				</f:facet>
				<ice:outputText value="#{emp.date_embauche}" />
			</ice:column>
 
			<!-- Salaire -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Salaire" />
				</f:facet>
				<ice:outputText value="#{emp.salaire}" />
			</ice:column>
			<!-- Fonction -->
			<ice:column>
				<f:facet name="header">
					<ice:outputText value="Fonction" />
				</f:facet>
				<ice:outputText value="#{emp.fonction}" />
			</ice:column>
		</ice:dataTable>
	</ice:form>
	</body>
	</html>
</f:view>
et voici le code d'erreur
java.lang.NullPointerException
at com.icesoft.faces.component.ext.RowSelector.processDecodes(RowSelector.java:407)
at com.icesoft.faces.component.ext.HtmlDataTable.processKids(HtmlDataTable.java:338)
at com.icesoft.faces.component.ext.HtmlDataTable.iterate(HtmlDataTable.java:293)
at com.icesoft.faces.component.panelseries.UISeries.processDecodes(UISeries.java:315)
at javax.faces.component.UIForm.processDecodes(UIForm.java:56)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:605)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:605)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:605)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:138)
at org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:132)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:74)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:31)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:26)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)