JSP Addressbook app for VIP Express (circa Jun 2002)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

34 lines
1.1 KiB

  1. // DataQueryServlet.java
  2. // SingleThreadModel servlet that will create and maintain database connections.
  3. // The database connection parameters are read from a properties file. The servlet
  4. // formulates queries based on the its request parameters and session properties.
  5. package com.bullseyecomputing.servlets;
  6. import java.io.*;
  7. import java.util.*;
  8. import java.sql.*;
  9. import javax.servlet.*;
  10. import javax.servlet.http.*;
  11. public class DataQueryServlet extends HttpServlet implements SingleThreadModel {
  12. // Initialization code
  13. Connection conn = null;
  14. public void init(ServletConfig config) throws ServletException {
  15. super.init(config)
  16. loadConnectionParameters();
  17. conn = createConnection();
  18. conn.setAutoCommit(false);
  19. }
  20. // HTTP GET handler
  21. public void doGet(HttpServletRequest request, HttpServletResponse response)
  22. throws ServletException, IOException {
  23. // Check for existing session
  24. HttpSession session = request.getSession(false);
  25. String user = session.getAttribute("j_username");
  26. // Get query parameters from the request args