Bonjour tout le monde j'ai un problème pour charger ma liste de catégorie je lève une exception du style : javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
alors mon code dans ma jsp
code dans l'action
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <html:select name="formulaireActionForm" onchange="chargecategorie();" property="idCategorieSelected"> <html:optionsCollection name="formulaireActionForm" property="listeCategorie" label="libelle" value="id"/> </html:select>
dans mon action form
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 package com.experian.pid.web.contact.actions; // Servlet imports import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; // Struts imports import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; // Experian imports import com.experian.pid.web.JdcBaseAction; import java.util.ArrayList; import org.apache.struts.util.ImageButtonBean; import com.experian.pid.web.SessionJDC; import com.experian.pid.db.web.login.UtilCompteOBJ; import com.experian.pid.web.ouvertureCompte.resources.OuvertureCompteResourceDelegate; import com.experian.pid.web.ouvertureCompte.resources.OuvertureCompteResourceDelegateImpl; import com.experian.pid.web.modifierCompte.forms.AjoutCompteUtilisateurActionForm; import com.experian.util.Localiseur; import com.experian.pid.db.web.modification.ModificationEJB; import com.experian.pid.db.web.modification.ModificationEJBHome; import com.experian.pid.web.contact.forms.*; import com.experian.pid.db.web.contact.ejb.*; import com.experian.pid.web.*; import com.experian.pid.db.web.modification.obj.*; import com.experian.pid.db.web.login.*; //import com.experian.pid.web.inscription.actions.commands.ValidationGestionCompteCommand; public class FormulaireAction extends JdcBaseAction { public ActionForward executeLogic(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception { logger.info("entre Dans l'action FormulaireAction"); FormulaireActionForm actionForm = (FormulaireActionForm) form; HttpSession session = request.getSession(true); //test session if ( (actionForm == null) || session.isNew()) { actionForm = new FormulaireActionForm(); actionForm.reset(mapping, request); session.setAttribute("formulaireActionForm", actionForm); } //recupération de la session SessionJDC sJDC = new SessionJDC(session); //recupération du compte UtilCompteOBJ compte = sJDC.getCompte(); if ( compte!= null){ UtilPersonneOBJ titulaire = compte.getLnkUtilPersonne(); String publi=request.getParameter("public"); if (publi!=null){ boolean isPartiePublique = Boolean.getBoolean(publi); actionForm.setPartiePublique(isPartiePublique); session.setAttribute("formulaireActionForm", actionForm); } else { actionForm.setNom(titulaire.getNom()); actionForm.setPrenom(titulaire.getPrenom()); actionForm.setRaisonSociale(compte.getRaisonSocialeClient()); actionForm.setMail(titulaire.getMail()); actionForm.setTelephone(titulaire.getNumeroTelephone()); actionForm.setCivilite(titulaire.getCivilite()); actionForm.setTelephone(titulaire.getNumeroTelephone()); } } //EJB ContactEJB ejb; Localiseur localiseur = new Localiseur(); ContactEJBHome home = (ContactEJBHome) localiseur.getHomeObject(ContactEJBHome. JNDI_NAME); ejb = home.create(); //test pour le remplissage de la categorie if (actionForm.getListeCategorie() == null) { // actionForm.setListeCategorie(bouchonCategorie()); actionForm.setListeCategorie(ejb.getListeCategorie(actionForm.isPartiePublique())); } String forward="FORMULAIRE"; //-------------------------- // GESTION BOUTON ENNVOYER //-------------------------- if (actionForm.getEnvoyer().isSelected()) { logger.info("clic sur le bouton envoyer"); ejb.getSoumettre(); //appel de l'EJB forward = "VISUALISER"; } logger.info("sort de l'action formulaireAction"); return mapping.findForward(forward); } }
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220 package com.experian.pid.web.contact.forms; // Servlet imports import java.util.*; import javax.servlet.http.*; import org.apache.struts.action.*; import org.apache.struts.util.*; import com.experian.pid.web.*; public class FormulaireActionForm extends BaseForm { private String nom; private String prenom; private String mail; private String telephone; private String sujet; private int idCategorieSelected; private ArrayList listeCategorie; private ImageButtonBean envoyer = new ImageButtonBean(); private String message; private int nbFichier; private String niveauUrgence; private boolean partiePublique; private String adresse; private String ville; private int codePostal; private String autres; private String raisonSociale; private boolean comptejedeclare; private boolean vousEtes; private String civilite; private int numClient; public String getNom() { return nom; } public String getPrenom() { return prenom; } public String getMail() { return mail; } public String getTelephone() { return telephone; } public int getIdCategorieSelected() { return idCategorieSelected; } public ArrayList getListeCategorie() { return listeCategorie; } public ImageButtonBean getEnvoyer() { return envoyer; } public String getSujet() { return sujet; } public String getMessage() { return message; } public int getNbFichier() { return nbFichier; } public String getNiveauUrgence() { return niveauUrgence; } public boolean isPartiePublique() { return partiePublique; } public String getAdresse() { return adresse; } public String getVille() { return ville; } public int getCodePostal() { return codePostal; } public String getAutres() { return autres; } public String getRaisonSociale() { return raisonSociale; } public boolean isComptejedeclare() { return comptejedeclare; } public boolean isVousEtes() { return vousEtes; } public String getCivilite() { return civilite; } public int getNumClient() { return numClient; } public void setNom(String nom) { this.nom = nom; } public void setPrenom(String prenom) { this.prenom = prenom; } public void setMail(String mail) { this.mail = mail; } public void setTelephone(String telephone) { this.telephone = telephone; } public void setSujet(String sujet) { this.sujet = sujet; } public void setIdCategorieSelected(int idCategorieSelected) { this.idCategorieSelected = idCategorieSelected; } public void setListeCategorie(ArrayList listeCategorie) { this.listeCategorie = listeCategorie; } public void setEnvoyer(ImageButtonBean envoyer) { this.envoyer = envoyer; } public void setMessage(String message) { this.message = message; } public void setNbFichier(int nbFichier) { this.nbFichier = nbFichier; } public void setNiveauUrgence(String niveauUrgence) { this.niveauUrgence = niveauUrgence; } public void setPartiePublique(boolean partiePublique) { this.partiePublique = partiePublique; } public void setAdresse(String adresse) { this.adresse = adresse; } public void setVille(String ville) { this.ville = ville; } public void setCodePostal(int codePostal) { this.codePostal = codePostal; } public void setAutres(String autres) { this.autres = autres; } public void setRaisonSociale(String raisonSociale) { this.raisonSociale = raisonSociale; } public void setComptejedeclare(boolean comptejedeclare) { this.comptejedeclare = comptejedeclare; } public void setVousEtes(boolean vousEtes) { this.vousEtes = vousEtes; } public void setCivilite(String civilite) { this.civilite = civilite; } public void setNumClient(int numClient) { this.numClient = numClient; } /** * reset * * @param mapping ActionMapping * @param request HttpServletRequest * @todo Implement this org.apache.struts.action.ActionForm method */ public void reset(ActionMapping mapping, HttpServletRequest request) { envoyer = new ImageButtonBean(); } }
Voilà est-ce que qu'equ'un a une idée svp
Partager