00001 import java.io.PrintWriter; 00002 import java.io.IOException; 00003 import javax.servlet.http.HttpServlet; 00004 import javax.servlet.http.HttpServletRequest; 00005 import javax.servlet.http.HttpServletResponse; 00006 import javax.servlet.ServletException; 00007 00008 public class Patients extends HttpServlet 00009 { 00010 public void doPost(HttpServletRequest req, HttpServletResponse res) 00011 throws ServletException, IOException 00012 { 00013 doGet(req, res); 00014 } 00015 00016 public void doGet(HttpServletRequest req, HttpServletResponse res) 00017 throws ServletException, IOException 00018 { 00019 res.setContentType("text/html"); 00020 PrintWriter pw = res.getWriter(); 00021 00022 Form f = new Form(req, res, pw, DoctorDb.getSingleton()); 00023 try 00024 { 00025 PatientList pl = new PatientList("pl", f); 00026 pl.loadValues(); 00027 Page p = new Page(req,res,pw); 00028 p.top("Patients"); 00029 pw.println("<form method=post>"); 00030 pl.display(); 00031 pw.println("</form>"); 00032 p.bottom(); 00033 } 00034 catch (Throwable t) 00035 { 00036 Widget.ShowException(t, pw); 00037 } 00038 finally 00039 { 00040 f.disconnectDb(); 00041 } 00042 } 00043 }