import java.sql.*; import java.lang.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class svConfigServlet 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/ // //----------------------------------------------------------------------------- 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"+ "ylabels true\n"+ "outline true\n"+ "legend true\n"+ "\n"+ "width 450\n"+ "height 420\n"+ "nCols 4\n"+ "nRows 7\n"+ "vSpace 30\n"+ "nSeries 3\n"+ "barwidth 60\n"+ "gridxpos 75\n"+ "gridypos 350\n"+ "depth3D 15\n"+ "ndecplaces 0\n"+ "labelOrientation 5\n"+ "labelsY 360\n"+ "chartScale 5000\n"+ "chartStartY 0\n"+ "\n"+ "label1 Quarter 1\n"+ "label2 Quarter 2\n"+ "label3 Quarter 3\n"+ "label4 Quarter 4\n"+ "\n"+ "font14 TimesRoman,I,10\n"+ "font15 TimesRoman,N,10\n"+ "\n"+ "color14 100,100,100\n"+ "color15 0,0,0\n"+ "color16 0,100,100\n"+ "color17 0,0,0\n"+ "color18 0,0,0\n"+ "color19 0,0,0\n"+ "\n"+ "legendfont Arial,N,10\n"+ "legendposition 200,5\n"+ "legendtitle Legend Title\n"+ "LegendBackground 200,200,200\n"+ "LegendBorder 125,125,125\n"+ "LegendtextColor 0,0,0\n"+ "\n"+ "\n"+ "title Sales by Quarter|50,20|TimesRoman,BI,18|100,100,100\n"+ "xtitle Year 2000|200,400|TimesRoman,B,16|100,100,100\n"+ "ytitle Value $|10,300|TimesRoman,B,16|100,100,100\n"+ "\n"+ "\n"+ "text1 Note :|80,60|TimesRoman,N,12|0,0,255\n"+ "text2 New product range|80,80|TimesRoman,N,12|0,0,0\n"+ "text3 launched during|80,100|TimesRoman,N,12|0,0,0\n"+ "text4 quarter 2.|80,120|TimesRoman,N,12|0,0,0\n"+ "\n"+ "\n"+ "series1 200,0,0|Series 1\n"+ "series2 200,0,200|Series 3\n"+ "series3 0,200,0|Series 3\n"; return(rsltStr); } //----------------------------------------------------------------------------- } // End class