Bonjour;
Je développe une application web.Le problème c'est que lorsque j’exécute le code facture.xhtml(et uniquement ce code) je reçois l'erreur suivante: java.lang.StackOverflowError.J'ai essaye de redémarrer le serveur, mais l'erreur persiste
le fichier facture.xhtml est le suivant:
Le bean factureBean.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
45
46
47 <?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" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:composite="http://java.sun.com/jsf/composite"> <head> </head> <body> <center> <h2> FACTURE </h2> </center> <hr /><hr /> <h:form> <br /> <h:panelGrid columns="2"> FOURNISSEUR: <h:selectOneMenu value="#{factu.nomf}"> <f:selectItems value="#{factu.listElements}" /> </h:selectOneMenu> </h:panelGrid> REFERENCE : <h:inputText value ="#{factu.reference}"/> <br /> <br /> <h:panelGrid columns="4" > PRODUIT : <h:selectOneMenu value="#{factu.prodnom}"> <f:selectItems value="#{factu.listElementsprod}" /> </h:selectOneMenu> <br /> QUANTITE : <h:inputText value ="#{factu.p.quantité}"/> <br /> PRIX_PRODUIT : <h:inputText value ="#{factu.pu}"/> <br /> TOTAL : <h:inputText value ="#{factu.total}"/> </h:panelGrid> <br /> <h:commandButton value=" + " action="#{factu.add }"/> <h:commandButton value="Ajouter" action="#{factu.ajouter }"/> </h:form> </body> </html>
Merci d'avance pour votre aide.
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
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 package com.xxx.facturation.controlleur; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.model.SelectItem; import com.xxx.facturation.dao.FactureDAO; import com.xxx.facturation.dao.FournisseurDAO; import com.xxx.facturation.dao.LignecomdDAO; import com.xxx.facturation.dao.ProduitDAO; import com.xxx.facturation.persistance.Facture; import com.xxx.facturation.persistance.Fournisseur; import com.xxx.facturation.persistance.Lignecomd; import com.xxx.facturation.persistance.Produit; @ManagedBean(name="factu") @SessionScoped public class FactureBean{ private String nomf; private String prodnom; private float total ; private float pu; private int qte; Lignecomd lcd= new Lignecomd(); private List<Lignecomd> listlcd= new ArrayList<Lignecomd>(); private List<Fournisseur> fs = new ArrayList<Fournisseur>(); private List<SelectItem>listElements; private List<Produit> prdt= new ArrayList<Produit>(); private List<SelectItem>listElementsprod; /********************************************************/ private Facture fac = new Facture(); private Produit p = new Produit(); private Fournisseur f = new Fournisseur(); FactureDAO factdao= new FactureDAO(); LignecomdDAO lcdao =new LignecomdDAO(); FournisseurDAO frndao= new FournisseurDAO(); ProduitDAO pdao=new ProduitDAO(); /*********************************************************/ public String ajouter(){ fac.setLcde(listlcd); factdao.ajouter(fac); return null; } public String getNomf() { return nomf; } public void setNomf(String nomf) { this.nomf = nomf; } public String getProdnom() { return prodnom; } public void setProdnom(String prodnom) { this.prodnom = prodnom; } public float getTotal() { return total; } public void setTotal(float total) { this.total = total; } public float getPu() { return pu; } public void setPu(float pu) { this.pu = pu; } public int getQte() { return qte; } public void setQte(int qte) { this.qte = qte; } public List<Lignecomd> getListlcd() { return listlcd; } public void setListlcd(List<Lignecomd> listlcd) { this.listlcd = listlcd; } public Facture getFac() { return fac; } public void setFac(Facture fac) { this.fac = fac; } public List<Fournisseur> getFs() { return fs; } public void setFs(List<Fournisseur> fs) { this.fs = fs; } /* affichage de la liste du fournisseur */ /*******************************************************************/ public List<SelectItem> getListElements() { listElements=new ArrayList<SelectItem>(); for(Fournisseur frn:frndao.selectAll()) listElements.add(new SelectItem(frn.getPrenom())); return listElements; } public void setListElements(List<SelectItem> listElements) { this.listElements = listElements; } public Produit getP() { return p; } public void setP(Produit p) { this.p = p; } public List<Produit> getPrdt() { return prdt; } public void setPrdt(List<Produit> prdt) { this.prdt = prdt; } /*affichage de la liste du produit */ /*********************************************************************/ public List<SelectItem> getListElementsprod() { listElementsprod=new ArrayList<SelectItem>(); for(Produit prod:pdao.selectAll()) listElementsprod.add(new SelectItem(prod.getNom())); return listElementsprod; } public void setListElementsprod(List<SelectItem> listElementsprod) { this.listElementsprod = listElementsprod; } public String add(){ /***************** Selection Produit ************************/ p=pdao.selectBynom(prodnom); prdt.add(p); p=new Produit(); prodnom=new String(); /***************** Selection Fournisseur ************************/ f=frndao.selectBynom(nomf); fs.add(f); f=new Fournisseur(); nomf=new String(); /**************** Selection Ligne de commande *************************/ listlcd.add(lcd); fac.setLcde(listlcd); lcd=new Lignecomd(); return null; } }
Partager