import java.sql.*; import java.lang.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class BarConfigServlet 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/bar_graph/hbargraph/index.htm // //----------------------------------------------------------------------------- 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"+ "grid: true \n"+ "axis: true \n"+ "xlabels: true \n"+ "outline: true \n"+ "legend: true \n"+ "autoscale: true \n"+ "gradientfill: true \n"+ " \n"+ "width: 450 \n"+ "height: 420 \n"+ "nCols: 4 \n"+ "nRows: 7 \n"+ "ndecplaces: 0 \n"+ "nSeries: 3 \n"+ "chartScale: 2000 \n"+ "chartStartY: -4000 \n"+ "labelsX_offset: 15 \n"+ "bar_spacing: 10 \n"+ "barwidth: 20 \n"+ "depth3D: 15 \n"+ "linkcursor: hand \n"+ "BackgroundColor: #FFFFFF \n"+ "barOutlineColor: #000000 \n"+ " \n"+ "gridxpos: 75 \n"+ "gridypos: 400 \n"+ "hSpace: 40 \n"+ "gridStyle: 2 \n"+ "gridColor: #888888 \n"+ "axisColor: #FF0000 \n"+ "floorColor: #00FF00 \n"+ "gridbgcolor: #80FFFF \n"+ "gridbgimage: gridbg.gif \n"+ " \n"+ "xlabel_font: Arial,N,12 \n"+ "ylabel_font: Arial,I,10 \n"+ "popupfont: Arial,B,12 \n"+ "labelColor: #FF0000 \n"+ "popupbgcolor: #999999 \n"+ "popup_pre: £ \n"+ "popup_post: mpg \n"+ "ylabel_pre: $ \n"+ "ylabel_post: \n"+ "thousandseparator: , \n"+ " \n"+ "label1: Quarter 1 \n"+ "label2: Quarter 2 \n"+ "label3: Quarter 3 \n"+ "label4: Quarter 4 \n"+ " \n"+ "legendfont: Arial,N,10 \n"+ "legendposition: 475,350 \n"+ "legendtitle: Legend Title \n"+ "LegendBackground: #F0F0F0 \n"+ "LegendBorder: #888888 \n"+ "LegendtextColor: #000000 \n"+ " \n"+ " \n"+ "title: Sales by Quarter|150,15|TimesRoman,BI,18|#888888 \n"+ "xtitle: Year 2001|150,475|TimesRoman,B,16|#888888 \n"+ "ytitle: Value $|10,200|TimesRoman,B,16|#888888 \n"+ " \n"+ " \n"+ "series1: #DDDDDD|Series 1|http://www.jpowered.com|new \n"+ "series2: #EE6666|Series 2 \n"+ "series3: #6666EE|Series 3 \n"; return(rsltStr); } //----------------------------------------------------------------------------- } // End class