Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Form.java

Go to the documentation of this file.
00001 import java.io.PrintWriter;
00002 import javax.servlet.http.HttpServletRequest;
00003 import javax.servlet.http.HttpServletResponse;
00004 import java.sql.Connection;
00005 import java.sql.SQLException;
00006 
00007 public class Form
00008 {
00009   public String name;
00010   public int method;
00011   
00012   public HttpServletRequest     req;
00013         public HttpServletResponse      res;
00014         public PrintWriter pw;
00015         public ConnectionFactory cf;
00016         public Connection conn;
00017         
00018         public Form(HttpServletRequest req, HttpServletResponse res, PrintWriter pw, ConnectionFactory cf)
00019         {
00020           this.req = req;
00021           this.res = res;
00022           this.pw = pw;
00023           this.cf = cf;
00024         }
00025         
00026         public Connection connectDb()
00027   {
00028     try
00029     {
00030       if (conn == null) conn = cf.connect();
00031     }
00032     catch (SQLException e)
00033     {
00034       Widget.ShowException(e,pw);
00035     }
00036     catch (ClassNotFoundException e)
00037     {
00038       Widget.ShowException(e,pw);
00039     }
00040     return conn; // convenience
00041   }
00042   
00043   public void disconnectDb()
00044   {
00045     try
00046     {
00047       cf.disconnect(conn);
00048       conn = null;
00049     }
00050     catch (SQLException e)
00051     {
00052       Widget.ShowException(e,pw);
00053     }
00054   }
00055 };

Generated on Mon Mar 6 23:34:34 2006 by  doxygen 1.4.4