Bonjour,
j'ai fait un formulaire que voici :
les item* sont des beans qui ont des info que je veux afficher à l'utilisateur pour confirmation, une fois la confirmation fait je les enregistrerai.
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 <html:form action="/confirmation.do"> <table> <tr> <td><html:text name="itemconfirmation" property="itemburger" value="<%= itemburger.getItemburger() %>" disabled="true"></html:text></td> </tr> <tr> <td><html:text name="itemconfirmation" property="itemfrite" value="<%= itemfrite.getItemfrite() %>" disabled="true"></html:text></td> </tr> <tr> <td><html:text name="itemconfirmation" property="itemboisson" value="<%= itemboisson.getItemboisson() %>" disabled="true"></html:text></td> </tr> <tr> <td><html:text name="itemconfirmation" property="itemformat" value="<%= itemformat.getItemformat() %>" disabled="true"></html:text></td> </tr> <tr> <td><html:submit><bean:message key="formulaire_de_login.confirmer"/></html:submit></td> </tr> <%-- %><tr><html:hidden property="itemboisson" name="itemboisson"></html:hidden></tr> --%> </table> </html:form>
une partie du struts-config :
le bean ItemConfirmation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <form-beans> <form-bean name="itemconfirmation" scope="session" type="item.ItemConfirmation"></form-bean> </form-beans> <action-mappings> <action input="/format.jsp" name="itemconfirmation" path="/confirmation" scope="session" type="action.Confirmation" validate="true"> <forward name="panier" path="/panier.jsp" redirect="true"></forward> </action> </action-mappings>
la classe Confirmation n'est pas un soucis ici je fais une simple redirection vers mon idex.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 package item; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class ItemConfirmation extends ActionForm { private static final long serialVersionUID = 2444317134153839766L; private String itemconfirmation; private String itemburger; private String itemfrite; private String itemboisson; private String itemformat; @Override public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { /** * il faut maintenant verifier que les objt sont bien recupéré */ System.out.println("itemconfirmation = " + itemconfirmation); System.out.println("itemburger = " + itemburger); System.out.println("itemfrite = " + itemfrite); System.out.println("itemboisson = " + itemboisson); System.out.println("itemformat = " + itemformat); return null; } /** * @return the itemconfirmation */ public String getItemconfirmation() { return itemconfirmation; } /** * @param itemconfirmation the itemconfirmation to set */ public void setItemconfirmation(String itemconfirmation) { this.itemconfirmation = itemconfirmation; } /** * @return the itemburger */ public String getItemburger() { return itemburger; } /** * @param itemburger the itemburger to set */ public void setItemburger(String itemburger) { this.itemburger = itemburger; } /** * @return the itemfrite */ public String getItemfrite() { return itemfrite; } /** * @param itemfrite the itemfrite to set */ public void setItemfrite(String itemfrite) { this.itemfrite = itemfrite; } /** * @return the itemboisson */ public String getItemboisson() { return itemboisson; } /** * @param itemboisson the itemboisson to set */ public void setItemboisson(String itemboisson) { this.itemboisson = itemboisson; } /** * @return the itemformat */ public String getItemformat() { return itemformat; } /** * @param itemformat the itemformat to set */ public void setItemformat(String itemformat) { this.itemformat = itemformat; } }
le soucis et que je n'arrive pas à récupérer la valeur des string à chaque fois je récupère la valeur null
est ce que vous pouvez m'aider svp
Partager