voila la methode :
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
 
    public void affiche() {
 
 
 
        final DefaultPieDataset data = new DefaultPieDataset();
        List<List> l = lDAO.getStatuFed();
        for (int i = 0; i < l.size(); i++) {
            String S = l.get(i).get(0).toString();
            double d = Double.valueOf(l.get(i).get(1).toString());
            data.setValue(S, new Double(d));
        }
 
 
 
 
 
        JFreeChart chart = ChartFactory.createPieChart("Tableau de bord : Fedilisation", data, true, true, false);
 
        try {
            final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
 
            final File file1 = new File("./web/images/pie.png");
            ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
 
 
 
        } catch (Exception e) {
            System.out.println(e);
        }
 
    }
la methode marche bien lorsque je l'appelle dans une main() .... mais lorqsque je l'appelle comme une action d'un commandButton,elle ne s'excute pas :'(

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<h:form  id="welcomeForm" enctype="multipart/form-data">
 
<p:commandButton ajax="false" action="#{tabBordFedBean.graphe()}" value="pie" />
 
</h:form>