Bonsoir ,

Au fait j'ai développé une page qui possède un panel qui contient des critères de recherche. Si le critère de recherche est valide j'affiche une ligne contenant les information (nom....)sinon j'affiche toute une liste.

Mon problème se situe que lorsque j’exécute la page 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
18
19
20
21
22
23
24
25
javax.servlet.ServletException: #{contactCtr.findListContact}: java.lang.NullPointerException
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
	org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
 
 
cause mère 
 
javax.faces.FacesException: #{contactCtr.findListContact}: java.lang.NullPointerException
	com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
	javax.faces.component.UICommand.broadcast(UICommand.java:387)
	org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
	org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
	org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
	org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
	com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
	org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
et voici la page ainsi que la methode :

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
<!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:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">
<head>
</head>
<body>
 
 
			<br></br>
			<br></br>
			<center>
				<b style="COLOR: #0080c0;">Consultation des Contacts</b>
			</center>
			<br></br>
			<f:view>
				<h:form>
					<rich:panel>
						<f:facet name="header">
							<h:outputText value="Criteres de Recherche" style="" />
						</f:facet>
						<h:outputText value="" style="COLOR: #0000ff; FONT-WEIGHT: bold;" />
						<h:panelGrid columns="2" style="FONT-WEIGHT: bold;">
							<h:outputText value="Type de piece :" />
							<h:selectOneMenu value="#{contactCtr.codTpceCnt}" d="true"
								id="type_piece_cnt" style="height : 22px; width : 156px;">
								<f:selectItem itemLabel="C" itemValue="C" />
								<f:selectItem itemLabel="P" itemValue="P" />
							</h:selectOneMenu>
							<h:outputText value="Numere de piece :" />
							<h:inputText value="#{contactCtr.numPieceCnt}" id="num_piece_cnt" />
						</h:panelGrid>
						<h:panelGrid columns="2">
							<h:commandButton value="Quitter" action="quitter"
								style="COLOR: #0000ff; FONT-WEIGHT: bold; width : 95px; height : 24px;" />
							<h:commandButton id="buttonchercher" value="Chercher"
								action="#{contactCtr.findListContact}"
								style="COLOR: #0000ff; FONT-WEIGHT: bold; width : 95px; height : 24px;" />
						</h:panelGrid>
					</rich:panel>
					<rich:dataTable value="#{contactCtr.ct}" var="contact">
 
						<f:facet name="header">
							<rich:columnGroup>
 
 
								<h:column>
									<h:outputText value="Nom" />
								</h:column>
								<h:column>
									<h:outputText value="Prenom" />
								</h:column>
								<h:column>
									<h:outputText value="Adresse" />
								</h:column>
								<h:column>
									<h:outputText value="Numero de GSM" />
								</h:column>
								<h:column>
									<h:outputText value="Type de piece" />
								</h:column>
								<h:column>
									<h:outputText value="Numero de piece" />
								</h:column>
							</rich:columnGroup>
						</f:facet>
						<h:column>
							<h:outputText value="#{contact.nomNomCnt}" />
						</h:column>
						<h:column>
							<h:outputText value="#{contact.nomPreCnt}" />
						</h:column>
						<h:column>
							<h:outputText value="#{contact.adrAdrCnt}" />
						</h:column>
						<h:column>
							<h:outputText value="#{contact.numGsmCnt}" />
						</h:column>
						<h:column>
							<h:outputText value="#{contact.codTpceCnt}" />
						</h:column>
						<h:column>
							<h:outputText value="#{contact.numPieceCnt}" />
						</h:column>
					</rich:dataTable>
				</h:form>
			</f:view>
 
</body>
</html>

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 public void findListContact()
    {
    	if(getNumPieceCnt()=="")
		{
			List<Contact> cnts =ctDao.findallContact();
			setCt(new ListDataModel(cnts));
		}
		else if(getNumPieceCnt()!="")
		{
		List<Contact> cnts = ctBus.recupererContactById(getNumPieceCnt());
		setCt(new ListDataModel(cnts));
		}	
    }

J'ai besoin de votre aide s'il vous plait car je trouve pas la solution
Merci