bonjour je veux afficher une partie de la table dans une page jsf je travaille avec netbeans
ma page jsf contient un selectOneListbox id="choice" donc l'utilisateur va choisir un item et selon cet item il y'aura un tri et afficher les données correspandant par exemple s'il choisit Appliance FW il va afficher juste les lignes où productfamily(nom de colonnes de ma base)= Appliance FW.

voila le code de mon bean:

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
49
 
/* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 
package fonction; 
 
import java.util.List; 
import javax.persistence.EntityManager; 
import javax.persistence.EntityManagerFactory; 
import javax.persistence.Persistence; 
 
/** 
* 
* @author Acer 
*/ 
public class tri { 
 
String choice; 
 
public String getChoice() { 
return choice; 
} 
 
public void setChoice(String choice) { 
this.choice = choice; 
} 
 
public List<tri> resultat(){ 
EntityManagerFactory emf; 
EntityManager em; 
String up = "EnterpriseApplication1-warPU"; 
 
 
emf = Persistence.createEntityManagerFactory(up); 
 
em = emf.createEntityManager(); 
 
List<tri> resultList = (List<tri>) (em.createNamedQuery("Europrice.findByProductFamily")) 
setParameter("productFamily",choice).getResultList(); 
 
return resultList; 
 
 
 
} 
 
 
}
donc ici je veux juste recupérer les lignes des Appliance FW
maintenant j'ai fait ce code pour afficher le resultList dans la page jsf
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
<h:form id="choix"> 
<h:selectOneListbox id="choice" size="1"> 
<f:selectItem itemLabel="Appliance-FW" /> 
<f:selectItem itemLabel="Appliance-IPS" value="#{tri.choice}"/> 
<f:selectItem itemLabel="--make your choice--" value="#{tri.choice}"/> 
</h:selectOneListbox> 
<br> 
<h:form> 
<h1><h:outputText value="List"/></h1> 
<h:dataTable value="#{europrice.tri}" var="item"> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="Id"/> 
</f:facet> 
<h:outputText value="#{item.id}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ProductCode"/> 
</f:facet> 
<h:outputText value="#{item.productCode}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ProductName"/> 
</f:facet> 
<h:outputText value="#{item.productName}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ProductDescription"/> 
</f:facet> 
<h:outputText value="#{item.productDescription}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ListPriceCurrency"/> 
</f:facet> 
<h:outputText value="#{item.listPriceCurrency}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ListPrice"/> 
</f:facet> 
<h:outputText value="#{item.listPrice}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="EndOfSalesDate"/> 
</f:facet> 
<h:outputText value="#{item.endOfSalesDate}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="EndOfSupportDate"/> 
</f:facet> 
<h:outputText value="#{item.endOfSupportDate}"/> 
</h:column> 
<h:column> 
<f:facet name="header"> 
<h:outputText value="ProductFamily"/> 
</f:facet> 
<h:outputText value="#{item.productFamily}"/> 
</h:column> 
</h:dataTable> 
</h:form> 
 
</h:form> 
 
</body> 
</html> 
</f:view>
mais j'ai pas reussi à faire ceci et je sais pas où est le probléme