Ok, here the code for the servlet that generates HTML: package simple_chart_view;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.Enumeration; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */ public class Servlet_SIMPLE_Chart_View extends HttpServlet { private static final String CONTENT_TYPE = "text/html"; //Initialize global variables private StringBuffer pageHtml = new StringBuffer(); private String selectedLang = ""; private String selectedType = ""; public void init() throws ServletException { pageHtml = new StringBuffer(); selectedLang = ""; selectedType = ""; } //Process the HTTP Get request public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } //Process the HTTP Post request public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { selectedLang = request.getParameter("lang"); selectedType = request.getParameter("type"); response.setContentType(CONTENT_TYPE); constructPage(); PrintWriter out = response.getWriter(); out.println(pageHtml.toString()); out.flush(); out.close(); } //Clean up resources public void destroy() { } private void constructPage() { java.util.Random rand = new java.util.Random(); int randInt = rand.nextInt(); pageHtml.append("<HTML>"); pageHtml.append("<HEAD>"); pageHtml.append("<TITLE>SIMPLE Chart</TITLE>"); pageHtml.append("</HEAD>"); pageHtml.append("<BODY>"); pageHtml.append("<P>"); pageHtml.append("Time Series Graph"); pageHtml.append("<P>"); if( selectedType != null ) { if( selectedType.equalsIgnoreCase("0") ) { pageHtml.append("<IMG SRC=\"ServletChartGenerator"); } else if( selectedType.equalsIgnoreCase("1") ) { pageHtml.append("<IMG SRC=\"ServletChartGenerator1"); } else if( selectedType.equalsIgnoreCase("2") ) { pageHtml.append("<IMG SRC=\"ServletChartGenerator2"); } } else{ pageHtml.append("<IMG SRC=\"ServletChartGenerator"); } if( selectedLang != null ) { if( selectedLang.equalsIgnoreCase("EN") ) { pageHtml.append("?lang=EN&id=" + randInt + "\""); } else if( selectedLang.equalsIgnoreCase("FR") ) { pageHtml.append("?lang=FR&id=" + randInt + "\""); } else if( selectedLang.equalsIgnoreCase("ALL") ) { pageHtml.append("?lang=ALL&id=" + randInt + "\""); } } else{ pageHtml.append("?lang=ALL&id=" + randInt + "\""); } pageHtml.append(" BORDER=1 WIDTH=800 HEIGHT=600/>"); pageHtml.append("</BODY>"); pageHtml.append("</HTML>"); } } I hope that will help. ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html