Bonjour, je veux vérifier si le code_client est existe dans base dans table client, s'il existe il m'affiche le nom de client
j'ai dans classe index.xhtml
et dans le classe Bean
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <h:panelGrid columns="3" cellpadding="5"> <p:outputLabel value="Code Client for="b" /> <p:autoComplete id="b" value="#{bean_clt.wcode}" /> <p:button value="" onclick="#{bean_clt.verifcod()}" icon="ui-icon-disk"/> <p:outputLabel value="Nom Client:" for="c" /> <p:autoComplete id="c" value="#{bean_clt.nm}" disabled="true"/> </h:panelGrid>
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 @Stateless public class Bean_clt { @EJB private TClientFacadeLocal em; private TClient cl = new TClient(); String wcode; String nm; public void verifcod() { if (em.find(wcode) != null) { TClient cli = new TClient(em.find(wcode)); //cl.setNomc(cli.getNomc()); nm=cli.getNom(); } } public TClientFacadeLocal getEm() {return em;} public void setEm(TClientFacadeLocal em) {this.em = em;} public TClient getCl() {return cl;} public void setCl(TClient cl) {this.cl = cl;} public String getWcode() {return wcode;} public void setWcode(String wcode) {this.wcode = wcode;} public String getNm() {return nm;} public void setNm(String nm) {this.nm = nm;} public Bean_clt() {}
Partager