title: JFreeChart Add Percentage to PieChart in JSP
body: <p>This is my code for creating a PieChart in JSP.</p>
  
  <pre><code>Connection conn = DBConnection.getConnection(); 
  
  String strQuery = "SELECT keyword,count(*) from paper_keywords group by keyword";
  PreparedStatement preparedStatement = conn.prepareStatement(strQuery);
  ResultSet rs = preparedStatement.executeQuery();
  
  DefaultPieDataset pieDataset = new DefaultPieDataset();
  while(rs.next())
  { 
      pieDataset.setValue(rs.getString(1),rs.getInt(2));
  }
  rs.close();
  preparedStatement.close();  
  
  JFreeChart chart = ChartFactory.createPieChart ("Popular Keywords", pieDataset, true,true,true);
  
  try {
      final ChartRenderingInfo info = new ChartRenderingInfo (new    StandardEntityCollection());
  
  
  String test = getServletContext().getRealPath("/");
  final File file1 = new File(test+"chart/areachart.png");
  
  ChartUtilities.saveChartAsPNG(file1, chart, 550, 400, info);
  } 
  catch (Exception e) {
  out.println(e);
  }
  </code></pre>
  
  <p>I will use it later in the jsp page:</p>
  
  <pre><code>&lt;IMG SRC="../chart/areachart.png" &gt;   
  </code></pre>
  
  <p>How can I add the percentage at legend? Thanks!</p>