Bonjour,
Je cherche à faire rafraîchir un textArea (que j'ai mis dans un WebMarkupContainer) grâce à un AjaxButton.
Pour mes tests je cherche à faire apparaître une String initialisée à "lol".
Le code HTML :
Le code JAVA :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <!-- Le bouton --> <button wicket:id="Refresh" value="Refresh" style="width:190;height:30;"></button> [...] <!-- Le WebMarkupContainer contenant le textArea --> <tr wicket:id="panelCommentaire"> <td colspan="1">Rappel des commentaires</td> <td colspan="3"> <textarea wicket:id="rappelCommentaire" rows="20" cols="90"></textarea> </td> </tr>
Quand je clique sur le bouton je devrais m'attendre à voir apparaître "lol" dans mon textArea. Or celui-ci reste désespérement vide.
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 final WebMarkupContainer panelCommentaire = new WebMarkupContainer("panelCommentaire"); String rappelCommentaire; // Ajout du textArea ayant pour model ma chaine rappelCommentaire panelCommentaire.add(new TextArea<String>("rappelCommentaire", new PropertyModel<String>("", rappelCommentaire))); // Positionné à true pour autoriser le refresh panelCommentaire.setOutputMarkupId(true); // Ajout au formulaire form.add(panelCommentaire); AjaxButton btnRefresh = new AjaxButton("Refresh") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { rappelCommentaire = "lol"; // refresh du WebMarkupContainer et dc du textArea target.add(panelCommentaire, "rappelCommentaire"); } }; // ajout du bouton au formulaire form.add(btnRefresh);
Quelqu'un aurait-il une idée du pourquoi ?
Merci
Partager