开发工具:
文件大小: 4mb
下载次数: 0
上传时间: 2014-05-31
详细说明: protected void doPost HttpServletRequest request HttpServletResponse response throws ServletException IOException { String action request getParameter "action" ; Teacher t new Teacher ; t setUsername request getParameter "username" ; if "register" equals action { t setPassword MD5 generateMD5 request getParameter "password" ; if teacherDao add t >0 { request getSession setAttribute "mess" "恭喜 注册成 功 " ; response sendRedirect "login jsp" ; }else{ response sendRedirect "error jsp" ; } }else if "login" equals action { t setPassword MD5 generateMD5 request getParameter "password" ; if teacherDao queryByTeacher t size >0 { Constants ONLINE COUNT++; Object oCount getServletContext getAttribute "count" ; if oCount null { getServletContext setAttribute "count" 1 ; }else{ getServletContext setAttribute "count" Integer getServletContext getAttribute "count" +1 ; } request getSession setAttribute "teacher" t ; request getSession setAttribute "students" studentDao queryStudentsByTeacher t ; if request getParameter "autoLogin" null { Cookie cookie1 new Cookie "username" t getUsername ; Cookie cookie2 new Cookie "password" t getPassword ; cookie1 setMaxAge 60 60 24 14 ; cookie2 setMaxAge 60 60 24 14 ; response addCookie cookie1 ; response addCookie cookie2 ; } response sendRedirect "index jsp" ; }else{ request setAttribute "mess" "用户名或密码错误 " ; request getRequestDispatcher "login jsp" forward request response ; } }else if "autoLogin" equals action { t setPassword request getParameter "password" ; if teacherDao queryByTeacher t size >0 { Constants ONLINE COUNT++; Object oCount getServletContext getAttribute "count" ; if oCount null { getServletContext setAttribute "count" 1 ; }else{ getServletContext setAttribute "count" Integer getServletContext getAttribute "count" +1 ; } request getSession setAttribute "teacher" t ; request getSession setAttribute "students" studentDao queryStudentsByTeacher t ; response sendRedirect "index jsp" ; }else{ request setAttribute "mess" "用户名或密码错误 " ; Cookie[] cookies request getCookies ; if cookies null { for Cookie cookie : cookies { if "username" equals cookie getName || "password" equals cookie getName { cookie setValue null ; 关键 cookie setMaxAge 0 ; response addCookie cookie ; } } } request getRequestDispatcher "login jsp" forward request response ; } }else if "loginOut" equals action { request getSession invalidate ; response sendRedirect "login jsp" ; } }">protected void doPost HttpServletRequest request HttpServletResponse response throws ServletException IOException { String action request getParameter "action" ; Teacher t new Teacher ; t setUsername request getParameter "username" ; if "register" equals ac [更多] ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.