View.java
上传用户:sxwtmm
上传日期:2022-08-11
资源大小:2183k
文件大小:2k
源码类别:

OA系统

开发平台:

Java

  1. /*
  2.  * Created on 2004-9-22
  3.  *
  4.  * To change the template for this generated file go to
  5.  * Window>Preferences>Java>Code Generation>Code and Comments
  6.  */
  7. package com.sign;
  8. import oa.sys.*;
  9. import oa.sys.Time;
  10. import oa.data.Sign;
  11. import java.io.*;
  12. import java.sql.*;
  13. import java.util.*;
  14. import javax.servlet.*;
  15. import javax.servlet.http.*;
  16. /**
  17.  ****************************************************
  18.  *类名称: Admin<br>
  19.  *类功能: 员工签到状态<br>
  20.  *创建: 白伟明 2004年10月5日<br>
  21.  ****************************************************
  22.  * To change the template for this generated type comment go to
  23.  * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
  24.  */
  25. public class View extends HttpServlet{
  26. private ResultSet rs=null;
  27. private Statement stmt=null;
  28. private String sqls=null;
  29. public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
  30. request.setCharacterEncoding("gb2312");
  31. response.setContentType("text/html; charset=gb2312");
  32. PrintWriter out = response.getWriter();
  33. HttpSession session=request.getSession();
  34. Db db=new Db();
  35. Time time=new Time();
  36. //获取签到表
  37. stmt=db.getStmtread();
  38. try {
  39. Collection coll=new ArrayList();
  40. stmt=db.getStmtread();
  41. rs=stmt.executeQuery("SELECT * FROM sign");
  42. while(rs.next()){
  43. Sign sign=new Sign();
  44. sign.setId(rs.getInt(1));
  45. sign.setTime(rs.getString(2));
  46. sign.setEmid(rs.getInt(3));
  47. sign.setLate(rs.getInt(4));
  48. sign.setQuit(rs.getInt(5));
  49. sign.setLeave(rs.getInt(6));
  50. sign.setWork(rs.getInt(7));
  51. sign.setSignstateid(rs.getInt(8));
  52. coll.add(sign);
  53. }
  54. request.setAttribute("msg",coll);
  55. } catch (SQLException e1) {
  56. e1.printStackTrace();
  57. }finally{
  58. db.close();
  59. RequestDispatcher dispatcher=request.getRequestDispatcher("view.jsp");
  60. dispatcher.forward(request,response);
  61. }
  62. }
  63. public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
  64. doPost(request,response);
  65. }
  66. }