Bonjour,
dans ma jsp j'affiche un tableau avec une colonne Montant. Je voudrais faire a la fin de ce tableau une ligne total de ces montants et je voulais savoir si on pouvait faire le calcul directement sur la jsp ...?
Merci
Bonjour,
dans ma jsp j'affiche un tableau avec une colonne Montant. Je voudrais faire a la fin de ce tableau une ligne total de ces montants et je voulais savoir si on pouvait faire le calcul directement sur la jsp ...?
Merci
Avec Struts-Layout on peut le faire directement dans le paramétrage de la colonne (attribut mathOperation)
Maintenant, sans Struts-Layout, on peut faire le cumul avec une expression, le problème reste d'ajouter une ligne au tableau et là, je ne vois que javascript pour le faire...
A+
Je fais comme ça pour le moment
Pour le Struts-Layout je ne vois pas le paramètre mathOperation
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 <logic:notEmpty name="FacturesBean" property="prestations"> <table> <thead> <tr> <th>Client</th> <th>N° Client</th> <th>N° Facture</th> <th>Montant</th> <th>Date de la facture</th> <th>Date envoi de la facture</th> <th>Action</th> </tr> </thead> <nested:iterate property="prestations" id="prestation" indexId="ctrPresta"> <td> <bean:write name="prestation" property="demandeur.nom"/> </td> <td> <bean:write name="prestation" property="demandeur.numClient"/> </td> <td> <bean:write name="prestation" property="demandeur.numFacture"/> </td> <td> <bean:write name="prestation" property="demandeur.prixPropose" format="#.##"/>€ </td> <td> <bean:write name="prestation" property="demandeur.dateFacture"/> </td> <td> <bean:write name="prestation" property="demandeur.dateEnvoie"/> </td> <td> <a href="javascript:soumettre('editerFacture', ${ctrPresta});">Editer facture</a> </td> </nested:iterate> <tr class="double"> <th>Total</th> <th></th> <th></th> <th><bean:write name="FacturesBean" property="prixTotal" format="#.##"/>€</th> <th></th> <th></th> <th></th> </tr> </table> </logic:notEmpty>
Struts-Layout
Donc je le transforme comme ceci
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 <logic:notEmpty name="FacturesBean" property="prestations"> <table> <thead> <tr> <layout:collection property="listTC" styleClass="FORM"> <layout:collectionItem property="Client" title="Client" style="width=20%;" sortable="true"/> <layout:collectionItem property="NumClient" title="N° Client" style="width=20%;" sortable="true"/> <layout:collectionItem property="NumFacture" title="N° Facture" style="width=20%;" sortable="true"/> <layout:collectionItem property="Montant" title="Montant" style="width=20%;" sortable="true"/> <layout:collectionItem property="DateFacture" title="Date de la facture" style="width=20%;" sortable="true"/> <layout:collectionItem property="DateEnvoiFacture" title="Date envoi de la facture" style="width=20%;" sortable="true"/> <layout:collectionItem property="Action" title="Action" style="width=20%;" sortable="false"/> </layout:collection> </tr> </thead> <nested:iterate property="prestations" id="prestation" indexId="ctrPresta"> <td> <bean:write name="prestation" property="demandeur.nom"/> </td> <td> <bean:write name="prestation" property="demandeur.numClient"/> </td> <td> <bean:write name="prestation" property="demandeur.numFacture"/> </td> <td> <bean:write name="prestation" property="demandeur.prixPropose" format="#.##"/>€ </td> <td> <bean:write name="prestation" property="demandeur.dateFacture"/> </td> <td> <bean:write name="prestation" property="demandeur.dateEnvoie"/> </td> <td> <a href="javascript:soumettre('editerFacture', ${ctrPresta});">Editer facture</a> </td> </nested:iterate> <tr class="double"> <th>Total</th> <th></th> <th></th> <th><bean:write name="FacturesBean" property="prixTotal" format="#.##"/>€</th> <th></th> <th></th> <th></th> </tr> </table> </logic:notEmpty>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <layout:collectionItem property="Montant" mathOperation="sum" title="Montant" style="width=20%;" sortable="true"/>
Partager