import java.sql.*; import java.lang.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class PieConfigServlet extends HttpServlet { // // This simple servlet is designed to demonstrate how a servlet can be used // to return configuration information to either the graphing applet or servlet. // As you will see the main routine ( doGet() ) uses the method // GraphData() to construct the return data. // Although in this example the GraphData() rountine simply builds the return // data from 'hard coded' values, in practice this rountine would be expanded // to first gather data from any number of datasources. // eg. databases, files other server processes. // // For further information visit, // http://www.jpowered.com/pie_chart/ // //----------------------------------------------------------------------------- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); ServletOutputStream out = res.getOutputStream(); // Return the Data out.println(ConfigData()); } // End doGet //----------------------------------------------------------------------------- public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {doGet(request, response);} //----------------------------------------------------------------------------- public static String ConfigData() { String rsltStr = "\n"+ "3D true\n"+ "Slabels true\n"+ "legend true\n"+ "\n"+ "width 600\n"+ "height 420\n"+ "nPies 3\n"+ "depth3D 20\n"+ "ndecplaces 0\n"+ "3Dangle 50\n"+ "\n"+ "font14 Arial,N,10\n"+ "font15 Arial,N,10\n"+ "\n"+ "color16 255,255,255\n"+ "color18 100,100,100\n"+ "\n"+ "legendfont Arial,N,10\n"+ "legendposition 475,200\n"+ "legendtitle Legend Title\n"+ "LegendBackground 255,255,255\n"+ "LegendBorder 125,125,125\n"+ "LegendtextColor 0,0,0\n"+ "\n"+ "\n"+ "title Sales by Region|200,15|Arial,BI,14|100,100,100\n"+ "\n"+ "\n"+ "text1 Product X|100,45|Arial,B,12|0,0,175\n"+ "text2 Product Y|350,45|Arial,B,12|0,0,175\n"+ "text3 Product Z|175,220|Arial,B,12|0,0,175\n"+ "\n"+ "\n"+ "Pie1 50,75,150,6,0\n"+ "Pie2 350,75,150,6,10\n"+ "Pie3 175,250,150,6,10\n"+ "\n"+ "pie1label1 North America\n"+ "pie1label2 Europe\n"+ "pie1label3 Asia\n"+ "pie1label4 Africa\n"+ "pie1label5 Australia\n"+ "pie1label6 South America\n"+ "pie2label1 North America\n"+ "pie2label2 Europe\n"+ "pie2label3 Asia\n"+ "pie2label4 Africa\n"+ "pie2label5 Australia\n"+ "pie2label6 South America\n"+ "pie3label1 North America\n"+ "pie3label2 Europe\n"+ "pie3label3 Asia\n"+ "pie3label4 Africa\n"+ "pie3label5 Australia\n"+ "pie3label6 South America\n"+ "\n"+ "