bonjour,
je m'excuse tout d'abord, cette discussion vous la trouver similaire à une autre précedemment posteé( discussion multipage) . j'ai essaye celle ci en se basant sur les denières modifications que je l'ai obtenu de la précedante .
j'ai commence a perdre l'espoirparceque c'est presque la majorite des discussions que j'ai vu à propos des listes déroulantes sont finies par resoudre leurs problème ,pour moi je sais pas comment en sortir .malgré les modifications qu'ils me supposent mais c'est cette erreur s'affiche toujours:
je veux que ma liste soit rempli à partir de ma base avant que j'ouvre la page.
Code : Sélectionner tout - Visualiser dans une fenêtre à part javax.servlet.ServletException: Cannot find bean: "machine" in any scope
voila ce que j'ai fais comme modification:
le struts-config.xml:
le foormulaire.reclamation.jsp:
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 struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"> <struts-config> <form-beans> name="frmReclamation" type="istia.st.struts.reclamation.controle.ReclamationBean"/> </form-beans><action path="/mainrec" name="frmReclamation" scope="session" validate="true" input="/erreursRec.do" parameter="/vues/mainrec.jsp" type="istia.st.struts.reclamation.controle.ReclamationAction"> <forward name="reponseRec" path="/vues/reponse.reclamation.jsp"/> </action> <action path="/formulaireRec" name="frmReclamation" type="istia.st.struts.reclamation.controle.CollectAction"> <forward name="collectOK" path="/vues/formulaire.reclamation.jsp"/> </action> <action path="/erreursRec" parameter="/vues/erreurs.reclamation.jsp" type="org.apache.struts.actions.ForwardAction" /> <action path="/reponseRec" parameter="/vues/reponse.reclamation.jsp" type="org.apache.struts.actions.ForwardAction" /> <action path="/formulaireRec" parameter="/vues/formulaire.reclamation.jsp" type="istia.st.struts.reclamation.controle.CollectAction" /> </action-mappings> <message-resources parameter="ressources.personneressources"/> <message-resources parameter="ressources.reclamationressources"/> </struts-config>
l'actionForm :
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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><meta http-equiv="pragma" content="no-cache"> <head><title>reclamation</title> <script language="javascript"> function effacer(){ with(document.frmReclamation){ serv_demandeur.value=""; demandeur.value=""; num_machine.value=""; etat.value=""; date_a.value=""; degre_u.value=""; date_p.value=""; description.value=""; } } </script> </head><body> <html:form action="/mainrec" method="POST" > <label>service demandeur : <html:select property="serv_demandeur" size="1" style="width:150px"> <html:option value ="" > </html:option> <html:option value = "1"> developpement</html:option> <html:option value = "2"> conception</html:option> <html:option value = "3"> installation</html:option> <html:option value = "4"> hardware-système</html:option> <html:option value = "5"> communication</html:option> </html:select> <br />demandeur : <html:text property="demandeur" size="1" style="width:150px"/></label><p> <label>désignation équipemet : <html:select property="num_machine" size="1" style="width:150px"> <html:optionsCollection name="machine" value="num_machine" label="code_machine"/> </html:select> </label></p><p><label>état : <html:select property="etat" style="width:150px"> <html:option value = ""></html:option> <html:option value = "1">arrét total</html:option> <html:option value = "2">mal fonctionnement</html:option> </html:select> </label></p><p><label>date d'envoi : <html:text property="date_e" /></label></p><p> <label>degré d'urgence : <html:select property= "degre_u"> <html:option value = ""></html:option> <html:option value = "1">urgent</html:option> <html:option value = "2">normal</html:option> </html:select></label></p><p> <label>date planifiée : <html:text property="date_p" /></label></p><p> <label>date d'arret : <html:text property="date_a" /></label></p><p> <label>description <html:textarea property="description"></html:textarea> <p> </p><p align="center"> <html:submit property="btnenvoyer" value="envoyer" /></label> <html:button property="btneffacer" value="effacer" onclick="effacer()"/> <html:submit property="btnquitter" value="quitter" /></p></html:form></body> </html>et la classe action:
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 package istia.st.struts.reclamation.controle; import istia.st.struts.geststock.modele.MachineEnCours; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; @SuppressWarnings("serial") public class ReclamationBean extends ActionForm{ private int n_bt; private String serv_demandeur; private String demandeur; private String num_machine; public Collection<MachineEnCours> machine ; private String etat; private String degre_u; private String date_e ; private String date_p ; private String date_a ; private String description ; private String etat_bt; public ReclamationBean() { super(); // TODO Auto-generated constructor stub } //début collection public Collection<MachineEnCours> getMachinecol() { return machine; } public void setMachinecol(Collection<MachineEnCours> machine) { this.machine = machine; }//fin collection public int getN_bt() { return n_bt; } public void setN_bt() { this.n_bt = this.n_bt+1; } public String getServ_demandeur() { return serv_demandeur; } public void setServ_demandeur(String serv_demandeur) { this.serv_demandeur = serv_demandeur; } public String getDemandeur() { return demandeur; } public void setDemandeur(String demandeur) { this.demandeur = demandeur; } public String getNum_machine() { return num_machine; } public void setNum_machine(String num_machine) { this.num_machine = num_machine; } public String getEtat() { return etat; } public void setEtat(String etat) { this.etat = etat; } public String getEtat_bt() { return etat_bt; } public void setEtat_bt(String etat_bt) { this.etat_bt = etat_bt; } public String getDegre_u() { return degre_u; } public void setDegre_u(String degre_u) { this.degre_u = degre_u; } public String getDate_e() { return date_e; } public void setDate_e(String date_e) { this.date_e = date_e; } public String getDate_p() { return date_p; } public void setDate_p(String date_p) { this.date_p = date_p; } public String getDate_a() { return date_a; } public void setDate_a(String date_a) { this.date_a = date_a; } public void setN_bt(int n_bt) { this.n_bt = n_bt; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } // la méthode validate() public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors erreurs = new ActionErrors(); if (serv_demandeur == null || serv_demandeur.trim().equals("")) { erreurs.add("serv_demandeur", new ActionMessage("reclamation.formulaire.serv_demandeur.vide")); } if (demandeur == null || demandeur.trim().equals("")) { erreurs.add("demandeur", new ActionMessage("reclamation.formulaire.demandeur.vide")); } if (num_machine== null || num_machine.trim().equals("")) { erreurs.add("num_machine", new ActionMessage("reclamation.formulaire.prenom.vide")); } if (etat== null || etat.trim().equals("")) { erreurs.add("etat", new ActionMessage("reclamation.formulaire.etat.vide")); } if (degre_u== null || degre_u.trim().equals("")) { erreurs.add("degre_u", new ActionMessage("reclamation.formulaire.degre_u.vide")); } if (date_e== null || date_e.trim().equals("")) { erreurs.add("date_e", new ActionMessage("reclamation.formulaire.date_e.vide")); } if (date_p== null || date_p.trim().equals("")) { erreurs.add("date_p", new ActionMessage("reclamation.formulaire.date_p.vide")); } if (date_a== null || date_a.trim().equals("")) { erreurs.add("date_a", new ActionMessage("reclamation.formulaire.date_a.vide")); } if (description== null || description.trim().equals("")) { erreurs.add("description", new ActionMessage("reclamation.formulaire.description.vide")); } return erreurs; } }
merci d'avance
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 package istia.st.struts.reclamation.controle; import istia.st.struts.reclamation.modele.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import istia.st.struts.geststock.modele.*; import javax.servlet.ServletException; public class CollectAction extends Action{ public ArrayList collect= new ArrayList(); public AccesBDBT abt=new AccesBDBT(); public ActionForward execute(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { AccesBDGestStock abbgs = new AccesBDGestStock(); ArrayList collect =abbgs.listnumMachine(); request.setAttribute("machine",collect); return mapping.findForward("collectOK"); } }
Partager