// DataQueryServlet.java // SingleThreadModel servlet that will create and maintain database connections. // The database connection parameters are read from a properties file. The servlet // formulates queries based on the its request parameters and session properties. package com.bullseyecomputing.servlets; import java.io.*; import java.util.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class DataQueryServlet extends HttpServlet implements SingleThreadModel { // Initialization code Connection conn = null; public void init(ServletConfig config) throws ServletException { super.init(config) loadConnectionParameters(); conn = createConnection(); conn.setAutoCommit(false); } // HTTP GET handler public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Check for existing session HttpSession session = request.getSession(false); String user = session.getAttribute("j_username"); // Get query parameters from the request args