Bonsoir;
J'ai besoin de votre aide.J'ai 2 pages une pour fournisseur (qui contient 3 champs nom , id et prenom) et une page pour facture qui contient une liste deroulante des prenom du fournisseur(qui doivent etre recupérés du champ prenom de la page fournisseur ).voici les deux fichiers xhtml et le bean.
facture.xhtml:
factureBean:
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:composite="http://java.sun.com/jsf/composite"> <head> </head> <body> <h:form> <h:panelGrid columns="2"> Id : <h:inputText value ="#{factureBean.fac.id}"/> Date : <h:inputText value ="#{factureBean.fac.date}"/> Fournisseur : <h:selectOneMenu value ="#{factureBean.fac.list}"/> <h:commandButton value="ajouter" action="#{factureBean.ajouter }"/> </h:panelGrid> </h:form> </body>
Merci d'avance.
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 package com.xxx.facturation.controlleur; import javax.annotation.ManagedBean; import javax.faces.bean.SessionScoped; import com.xxx.facturation.dao.FactureDAO; import com.xxx.facturation.persistance.Facture; import com.xxx.facturation.persistance.Fournisseur; @ManagedBean @SessionScoped public class FactureBean { private String list; private Fournisseur f = new Fournisseur(); private Facture fac = new Facture(); public Facture getFac() { return fac; } public void setFac(Facture fac) { this.fac = fac; } FactureDAO fa= new FactureDAO(); public String ajouter(){ fa.ajouter(fac); return "Produit "; } public Fournisseur getF() { return f; } public void setF(Fournisseur f) { this.f = f; } public String getList() { return list; } public void setList(String list) { list=f.getPrenom(); this.list = list; } }
Partager