Bonjour à tous,

Je vous expose rapidement mon problème : j'ai récupérer une application web faite par un autre, que je dois faire évoluer et je suis confronté à cette situation : J'ai un objet Commande mappé dans la page web, qui est récupéré par le controller. Cet objet est notamment composé de lignes de commandes, typés objet. J'ai rajouté un champ description dans la base de données, dans les attributs de la classe LigneCommande, et dans la page web. Pourtant le controller ne récupère pas les valeurs du champ de ce nouvel attribut.

Je ne sais pas si j'explique bien donc voici les bouts de code pertinents :

la classe LigneCommande :
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
package batiment.bean;
 
import java.io.Serializable;
import java.util.Date;
 
import batiment.util.MontantUtil;
 
public class LigneCommande implements Serializable{
 
	private int numero;
	private String numeroBordereau;
	private String marque;
	private String article;
	private String description;
	private String reference;
	private String conditionnement;
	private int quantite;
	private double prixUnitaireBrut;
	private double remiseEnPourcent;
	private double tva;
	private String delaiLivraison;
	private Date dateReception;
+ getter et setter

La 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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
 
<%@ include file="../inc/header.jsp" %>
 
 
<div id="main">
 
	<div id="main_inner" class="fluid">
 
	<!-- DEBUT CONTENU -->
	<div id="primaryContent_columnless">
		<div id="columnA_columnless">
			<h3>
				OS N° <c:out value="${param.osid}" /> - Edition d'une commande
			</h3>
				<form:form method="POST" commandName="editCommande">
					<table width="100%" class="cell-padding-light">
						<caption></caption>
						<tr>
							<td width="180">Date de signature</td>
							<td>
								<spring:bind path="dateSignature">
									<input size="10" type="text" class="datepicker" maxlength="10" value="${status.value }" name="${status.expression}"/>
								</spring:bind>
								<br />
							</td>
						</tr>
						<tr>
							<td width="180">Libellé commande</td>
							<td>
								<spring:bind path="libelle">
									<input size="45" type="text" value="${status.value }" name="${status.expression}"/>
								</spring:bind>
								<br />							
							</td>
						</tr>
						<tr>
							<td width="180">Visa commande</td>
							<td>
								<form:checkbox path="visaCommande"  onclick="toggleCurrentDate(this, '#dateVisaCommande')" />
							</td>
						</tr>
						<tr>
							<td width="180">Date visa commande</td>
							<td>
								<spring:bind path="dateVisaCommande">
									<input size="10" type="text" value="${status.value }" id="${status.expression}" name="${status.expression}"/>
								</spring:bind>
								<br />
							</td>
						</tr>
						<tr>
							<td width="180">Fournisseur</td>
							<td>
								<center>
									<spring:bind path="fournisseur">							
										<select name="${status.expression}">
											<c:forEach items="${fournisseurs}" var="f">
												<option <c:if test="${f.idFournisseur == status.value}">selected</c:if> value="${f.idFournisseur}">${f.libelleFournisseur} ( ${f.libelleMarche} )</option>
											</c:forEach>
										</select>	
									</spring:bind>
								</center>
							</td>
						</tr>
					</table>
					<table width="100%">					
						<tr>
							<td colspan="2">
								<h4>
									Ajout des lignes de commandes
									<div class="right" id="log"></div>																				
								</h4>
								<table width="100%" id="commandes" cellspacing="0" cellpadding="5" class="border-table">
									<caption></caption>
									<thead>
										<tr class="border-right-column-all">
											<th width="40"><input type="checkbox" onclick="toggleCheckAll(this, '#commandes', '#sampleRows', 'row-selected')"/></th>
											<th>Lignes commandes</th>
											<th width="80">Montant HT</th>
											<th width="80">Montant TTC</th>
										</tr>
									</thead>
									<tr id="sampleRows" style="display:none;">
										<td width="40" class="border-right"><input class="row_checkbox" onclick="toggleRowSelected(this, 'row-selected')" type="checkbox"/></td>								
										<td class="border-right">
											<table width="100%">
												<caption></caption>
												<tr>
													<td width="33%">
														<table width="100%">
															<tr>
																<td>N° bordereau</td>
																<td><input size="3" type="text" class="numeroBordereau" /></td>
															</tr>
															<tr>
																<td>Marque</td>
																<td><input size="15" type="text" class="marque" /></td>
															</tr>
															<tr>
																<td>Article</td>
																<td><input size="15" type="text" class="article" /></td>
															</tr>
															<tr>
																<td>Description</td>
																<td><input size="30" type="text" class="description" /></td>
															</tr>
														</table>
													</td>
													<td width="36%">
														<table width="100%">
															<tr>
																<td>Délai livraison</td>
																<td><input size="10" type="text" class="delaiLivraison" /></td>
															</tr>
															<tr>															
																<td>Conditionnement</td>
																<td><input size="15" type="text" class="conditionnement" /></td>
															</tr>														
															<tr>
																<td>Référence</td>
																<td><input size="7" type="text" class="reference" /></td>
															</tr>
															<tr>
																<td>Quantité</td>
																<td><input size="7" value="1" type="text" class="quantite" /></td>
															</tr>																																														
														</table>													
													</td>
													<td>
														<table width="100%">
															<tr>
																<td>Date réception</td>
																<td><input size="10" maxlength="10" type="text" class="dateReception" /></td>
															</tr>
															<tr>
																<td>Prix unitaire brut</td>
																<td><input size="7" type="text" class="prixUnitaireBrut" onchange="calculMontantTTC(this, 'input.remiseEnPourcent', 'select.tva', 'td.montantTTC'); calculMontantHT(this, 'input.remiseEnPourcent', 'td.montantHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantHT', '#montantTotalHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');"/></td>
															</tr>
															<tr>
																<td>Remise en %</td>
																<td><input size="7" type="text" class="remiseEnPourcent" onchange="calculMontantTTCRemise(this, 'input.prixUnitaireBrut', 'select.tva', 'td.montantTTC');calculMontantHTRemise(this, 'input.prixUnitaireBrut', 'td.montantHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantHT', '#montantTotalHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');" /></td>
															</tr>
															<tr>
																<td>Tva</td>
																<td>
																	<select class="tva" onchange="calculMontantTTCTVA(this, 'input.remiseEnPourcent', 'input.prixUnitaireBrut', 'td.montantTTC'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');">
																		<c:forEach  items="${availableTVA}" var="tva">
																			<option value="${tva.key}">${tva.value}</option>											
																		</c:forEach>
																	</select>
																</td>																
															</tr>															
														</table>														
													</td>													
												</tr>
											</table>										
										</td>
										<td class="montantHT number border-right">0</td>
										<td class="montantTTC number border-right">0</td>
									</tr>
									<!-- LIST -->
									<c:forEach items="${editCommande.lignesCommande}" var="ligne">
										<tr>
											<td width="40" class="border-right"><input class="row_checkbox" onclick="toggleRowSelected(this, 'row-selected')" type="checkbox"/></td>								
											<td class="border-right">
												<table width="100%">
													<caption></caption>
													<tr>
														<td width="33%">
															<input type="hidden" value="${ligne.numero}" class="numero"/>
															<table width="100%">
																<tr>
																	<td>N° bordereau</td>
																	<td><input value="${ligne.numeroBordereau}" size="3" type="text" class="numeroBordereau" /></td>
																</tr>
																<tr>
																	<td>Marque</td>
																	<td><input value="${ligne.marque}" size="15" type="text" class="marque" /></td>
																</tr>
																<tr>
																	<td>Article</td>
																	<td><input value="${ligne.article}" size="15" type="text" class="article" /></td>
																</tr>	
																<tr>
																	<td>Description</td>
																	<td><input value="${ligne.description}" size="30" type="text" class="description" /></td>
																</tr>															
															</table>
														</td>
														<td width="33%">
															<table width="100%">
																<tr>
																	<td>Délai livraison</td>
																	<td><input size="10" type="text" class="delaiLivraison" value="${ligne.delaiLivraison}" /></td>
																</tr>
																<tr>															
																	<td>Conditionnement</td>
																	<td><input value="${ligne.conditionnement}" size="7" type="text" class="conditionnement" /></td>
																</tr>														
																<tr>
																	<td>Référence</td>
																	<td><input value="${ligne.reference}" size="7" type="text" class="reference" /></td>
																</tr>
																<tr>
																	<td>Quantité</td>
																	<td><input value="${ligne.quantite}" size="7" type="text" class="quantite" /></td>
																</tr>		
 
															</table>													
														</td>
														<td>
															<table width="100%">
																<tr>																					<tr>
																	<td>Date réception</td>
																	<td><input size="10" maxlength="10" type="text" class="dateReception datepicker" value='<fmt:formatDate pattern="dd/MM/yyyy" value="${ligne.dateReception}" />'/></td>
																</tr>
																<tr>
																	<td>Prix unitaire brut</td>
																	<td><input size="7" value="${ligne.prixUnitaireBrut}" type="text" class="prixUnitaireBrut" onchange="calculMontantTTC(this, 'input.remiseEnPourcent', 'select.tva', 'td.montantTTC'); calculMontantHT(this, 'input.remiseEnPourcent', 'td.montantHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantHT', '#montantTotalHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');"/></td>
																</tr>
																<tr>
																	<td>Remise en %</td>
																	<td><input size="7" value="${ligne.remiseEnPourcent}" type="text" class="remiseEnPourcent" onchange="calculMontantTTCRemise(this, 'input.prixUnitaireBrut', 'select.tva', 'td.montantTTC');calculMontantHTRemise(this, 'input.prixUnitaireBrut', 'td.montantHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantHT', '#montantTotalHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');" /></td>
																</tr>
																<tr>
																	<td>Tva</td>
																	<td>
																		<select class="tva" onchange="calculMontantTTCTVA(this, 'input.remiseEnPourcent', 'input.prixUnitaireBrut', 'td.montantTTC'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');">
																			<c:forEach  items="${availableTVA}" var="tva">
																				<option value="${tva.key}"
																				<c:if test="${tva.key == ligne.tva}">selected</c:if>
																				>${tva.value}</option>											
																			</c:forEach>
																		</select>
																	</td>																
																</tr>															
															</table>														
														</td>													
													</tr>
												</table>							
											</td>
											<td class="montantHT number border-right">${ligne.montantHT}</td>
											<td class="montantTTC number border-right">${ligne.montantTTC}</td>
										</tr>
									</c:forEach>					
									<!-- FIN LIST -->								
									<tfoot>
										<tr class="border-right-column-all">
											<td colspan="2"><span class="total-cmd">Total montants (euros)</span></td>
											<td class="number" id="montantTotalHT">${editCommande.totalMontantHT}</td>
											<td class="number" id="montantTotalTTC">${editCommande.totalMontantTTC}</td>
										</tr>
									</tfoot>								
								</table>
								<div style="padding:10px">
									<span class="plus-button" onclick="addRow('#commandes', '#sampleRows')">Ajouter une commande</span>
									<span class="del-button" onclick="removeLigneRows('#commandes', '#sampleRows'); calculMontantHT(this, 'input.remiseEnPourcent', 'td.montantHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantHT', '#montantTotalHT'); calculTotalMontant('#commandes', '#sampleRows', '.montantTTC', '#montantTotalTTC');">Supprimer la séléction</span>								
								</div>								
							</td>
						</tr>																			
						<tr>
							<td colspan="2" align="center" style="padding:15px" id="submit-buttons">
								<input type="submit" class="button" id="soumettre" name="soumettre" value="confirmer" />
								<input type="button" class="button" value="Retour à l' OS" onclick="redirect(this)" target="editos.do?id=${param.osid}"/>
							</td>
						</tr>
					</table>
				</form:form>				
			</div>
		</div>
	</div>
	<!-- FIN CONTENU -->
 
<%@ include file="../inc/footer.jsp" %>
 
<script type="text/javascript">
$(function(){
	datepicker('.datepicker');
	plusButton('.plus-button');
	delButton('.del-button');
	$('#soumettre').click(function(){
		submitCmd('#editCommande', '#sampleRows');
		return false;
	});
});
</script>
 
<iframe id="printframe" style="height:0px;width:0px;border:none"></iframe>
le controller :
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
@Override
	protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
 
		Commande cmd = (Commande) command;
		StringBuffer url = new StringBuffer(this.editOSUrl);
 
		int id = ServletRequestUtils.getIntParameter(request, "osid");
 
		url.append("?id=");
		url.append(id);
 
		OrdreService os = this.osManager.get(id);
		ArrayList<LigneCommande> lignes = new ArrayList<LigneCommande>(cmd.getLignesCommande());
		System.out.println("controller "+lignes.get(0).getDescription());
		os.setCommande(cmd);
 
		this.osManager.update(os);
 
		return new ModelAndView(new RedirectView(url.toString()));
	}
et le fichier de config :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<bean name="editCommandeController" class="batiment.controllers.EditCommandeController">
		<property name="formView" value="/admin/editcmd"></property>
		<property name="commandClass" value="batiment.bean.Commande"></property>
		<property name="commandName" value="editCommande"></property>
		<property name="successView" value="search.do"></property>
		<property name="osManager" ref="osManager"></property>
		<property name="editOSUrl" value="editos.do"></property>
		<property name="fournisseurManager" ref="fournisseurManager"></property>
		<property name="dynamicLigneCommandeManager" ref="dynamicLigneCommandeManager"></property>
	</bean>
Voilà, merci d'avance pour votre aide