bonjour,

j'ai une servlet qui contient des données que je veux les transmettre vers une

page jsp codée en javascript

mon but c'est de récupérer les données de mon servlet et l'introduire dans la

page jsp de chart et afficher un statistique de ces données.

j'ai trouvé une solution avec jquery mais ça pas marcher!!

voilà mon code de servlet
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
 
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
String nom=request.getParameter("itemselected"); // récuperer les données 
 
de page jsp
 
 
		Serveur ser=parser.getServeurByNom(nom);
		PrintWriter out=response.getWriter();
 
String s=ser.getCpu()+"";
s+=ser.getHd()+"";
s+=ser.getRam()+"";
out.write(s);
super.doPost(request, response);
 
	}
voilà le code de chart page jsp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 
    pageEncoding="ISO-8859-1"%>
<!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">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/LoginRichFaces/js/highcharts.js"></script>
<script type="text/javascript" src="/LoginRichFaces/js/modules/exporting.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
                
                                var tabXML = [];
                var chart;
                var h1,y1,y2;
                        $(document).ready(function() {
                        
                jQuery.get('/firstChart/ServletChart', null, function(data) {
                
                
                        // split the data return into lines and parse them
                                        
                                        jQuery.each(data, function(i, line) {
                                 line=line.split("");
                        
                        
                        h1=line[0]+'';
                        y1=line[1];
 
        
                                          });
                                          
                                chart = new Highcharts.Chart({
                                        chart: {
                                                renderTo: 'container',
                                                plotBackgroundColor: null,
                                                plotBorderWidth: null,
                                                plotShadow: false
                                        },
                                        title: {
                                                text: 'Statistique'
                                        },
                                        tooltip: {
                                                formatter: function() {
                                                        return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
                                                }
                                        },
                                        plotOptions: {
                                                pie: {
                                                        allowPointSelect: true,
                                                        cursor: 'pointer',
                                                        dataLabels: {
                                                                enabled: true,
                                                                color: '#000000',
                                                                connectorColor: '#000000',
                                                                formatter: function() {
                                                                        return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
                                                                }
                                                        }
                                                }
                                        },
                                    series: [{
                                                type: 'pie',
                                                name: 'Browser share',
                                                data: [
                                                        [h1, parseFloat(y1)],
                                                        ['rest',parseFloat(100-y1)],
                                                
                                                        
                                                
                                                ]
            }]
        });
        
                });  
        
    });
 
 
                
                                
                </script>
 
<div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div>
 
 
</body>
</html>

voilà le code simple de hight chart
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
 
var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'container',
         plotBackgroundColor: null,
         plotBorderWidth: null,
         plotShadow: false
      },
      title: {
         text: 'Browser market shares at a specific website, 2010'
      },
      tooltip: {
         formatter: function() {
            return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
         }
      },
      plotOptions: {
         pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
               enabled: false
            },
            showInLegend: true
         }
      },
       series: [{
         type: 'pie',
         name: 'Browser share',
         data: [
            ['Firefox',   45.0],
            ['IE',       26.8],
            {
               name: 'Chrome',    
               y: 12.8,
               sliced: true,
               selected: true
            },
            ['Safari',    8.5],
            ['Opera',     6.2],
            ['Others',   0.7]
         ]
      }]
   });
});
vraiment je suis bloqué surtout que j'ai pas une idée sur l'utilisation de jquery !!!