Bonjour,
j'essaie de créer un formulaire dynamique. J'en ai fait d'autres qui marche bien mais celui-là j'en obtient rien : une page blanche en fait...
voilà ce que j'ai fait :
salle.jsp :
struts config:
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 <html:form action="/affecter"> <table> <tr> <td> Salles disponibles </td> <td> Tables </td> </tr> <tr> <td> <html:select property="salle"> <%for(int i=0;i<tableauSalles.length;i++){ %> <html:option value="<%=tableauSalles[i][0] %>"> <%=tableauSalles[i][1] %> </html:option> <%} %> </html:select> </td> <td> <html:select property="table"> <%for(int i=0;i<tableauTables.length;i++){ %> <html:option value="<%=tableauTables[i][0] %>"> <%=tableauSalles[i][5] %>, <%=tableauSalles[i][7] %>,<%=tableauSalles[i][2] %> </html:option> <%} %> </html:select> </td> </tr> <tr> <td> <html:submit value="Affecter"/> </td> <td> </td> </tr> </table> </html:form>
AffectSalleAction.java :
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 ... <form-bean name="affectSalle" type="formulaires.AffectSalleDynaForm"> <form-property name="salle" type="java.lang.String" initial=""/> <form-property name="table" type="java.lang.String" initial=""/> </form-bean> ... <action path="/affecter" name="affectSalle" scope="request" validate="false" type="formulaires.AffectSalleAction" > <forward name="reponse" path="/listeSalles.do"/> </action> ...
et enfin AffectSalleDynaForm.java:
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 ... public class AffectSalleAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse reponse) throws IOException,ServletException{ //le formulaire est valide AffectSalleDynaForm formulaire=(AffectSalleDynaForm)form; //update de la table avec la salle request.setAttribute("test", formulaire.get("salle")); return mapping.findForward("reponse"); } }
Alors voilà, quand à travers tomcat j'appelle la page contenant le formulaire, j'obtiens une page blanche, je préfèrerais un message d'erreur mais non rien... Si je retire le formulaire la page s'affiche bien...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 public class AffectSalleDynaForm extends DynaActionForm { /** * */ private static final long serialVersionUID = 3441732281464978379L; }
Ca fait des heures que je cherche mais là vraiment je comprend pas...
Partager