Jsf inputText Dynamique

kerfahi Messages postés 88 Date d'inscription lundi 24 novembre 2008 Statut Membre Dernière intervention 5 mai 2013 - 22 mars 2012 à 10:44
 scorpiontlili - 24 juin 2013 à 15:41
bonjour,

je veux savoir comment ajouter dynamiquement un InputText??
j'ai des users qui sont variable.mon problem c'est lorsque j'ajoute des users moi je doit presiser le nombre .par exemple en cliquant sur un boutton + ,un autre inputText s'affiche.

merci

1 réponse

scorpiontlili
24 juin 2013 à 15:41
voici comment :
cet exemple crée dynamiquement un inputText Jsf
Dans l'interface tu mettera :
<h:form>
<h:panelGrid binding="#{beanBindingExemple.containerComponent}"
columns="4" id="gridPanel1">

</h:panelGrid>
</h:form>


Dans le bean managed :
public void addComponent(){

containerComponent.getChildren().clear();
UIColumn col = new UIColumn();
UIColumn col1 = new UIColumn();
HtmlOutputText ot = new HtmlOutputText();
HtmlOutputText ot1 = new HtmlOutputText();
HtmlInputText it1 = new HtmlInputText();
HtmlInputText it = new HtmlInputText();
ot.setValue("valeur Min :");
col.getChildren().add(ot);
it.setValue(name);
col.getChildren().add(it);
ot1.setValue("valeur Max :");
col1.getChildren().add(ot1);
it1.setValue("");
col1.getChildren().add(it1);

if (containerComponent == null) {
containerComponent = new HtmlPanelGrid();
}
containerComponent.getChildren().add(col);
containerComponent.getChildren().add(col1);

}

0
Rejoignez-nous