员工管理系统j2ee应用架构与eclipse开发技术课程(编辑修改稿)内容摘要:
g getUser(){return strUser。 } public String getPswd(){return strPswd。 } public String getName(){return strName。 } public String getTel(){return strTel。 } public String getEmail(){return strEmail。 } public int getIsAdmin(){return iIsAdmin。 } } UserLogin 类(用于完成用户登录验证和密码修改) package。 import .*。 public class UserLogin{ public int login(String strUser,String strPswd,User user){ int re=0。 DBAgent dba=null。 try { String sql=select * from stufflist where user=39。 +strUser+39。 (sql)。 dba=new DBAgent()。 ResultSet rs=(sql)。 if (rs!=null){ if (!()) re=1。 else{ if(((password))) { ((id),(user),(name),(password),(tel),(),(isadmin))。 }else re=2。 } }else re=1。 } catch (Exception e) { ()。 《 J2EE 应用架构与 Eclipse 开发技术》 课程设计报告 Date: 20xx65 Page 15 of 25 } finally { try { if (dba !=null) ()。 }catch (Exception e){ ()。 } } return re。 } //修改密码 public boolean modifyPswd(String strUser,String strOldPswd,String strNewPswd) { boolean re=false。 DBAgent dba=null。 try{ String sql=update stufflist set password=39。 +strNewPswd+39。 where user=39。 +strUser+39。 and password39。 +39。 dba=new DBAgent()。 re=(sql) 0 ? true : false。 } catch (Exception e) { re =false。 ()。 } finally { try { if (dba !=null) ()。 } catch (Exception e) { ()。 } } return re。 } } StuffAdmin 类(用于完成员工管理功能) package。 import。 public class StuffAdmin { public int addStuff(User user ){ int id=1。 DBAgent dba=null。 try{ dba=new DBAgent()。 ResultSet rs=(select * from stufflist where user=39。 +()+39。 )。 if(()) id=2。 else 《 J2EE 应用架构与 Eclipse 开发技术》 课程设计报告 Date: 20xx65 Page 16 of 25 id=(insert into stufflist(user,password,name,tel,,isadmin)+values(39。 +()+39。 ,39。 +us()+39。 ,39。 +()+39。 ,39。 +()+39。 ,39。 +()+39。 ,39。 +u()+),id)。 }catch(Exception e){ ()。 }finally{ try{ if(dba!=null) ()。 }catch(Exception e){ ()。 } } return id。 } public boolean delStuff(int iUserID){ boolean re=false。 DBAgent dba=null。 try{ dba=new DBAgent()。 re=(delete from stufflist where id=+iUserID) 0 ? true : false。 }catch(Exception e){ ()。 }finally{ try{ if(dba!=null) ()。 }catch(Exception e){ ()。 } } return re。 } public boolean updateStuff(User user){ boolean re=false。 DBAgent dba=null。 try{dba=new DBAgent()。 ResultSet rs=(select * from stufflist where user=39。 +()+39。 )。 if(!(())) re=(update stufflist set user=39。 +()+39。 ,password=39。 +()+39。 ,name=39。 +()+39。 ,tel=39。 +()+39。 ,=39。 +()+39。 ,isadmin=39。 +()+where id=+()) 0 ? true: false。 }catch (Exception e){ ()。 }finally{ try{ 《 J2EE 应用架构与 Eclipse 开发技术》 课程设计报告 Date: 20xx65 Page 17 of 25 if(dba!=null) ()。 }catch(Exception e){ ()。 } } return re。 } } ViewList 类(把数据库里的员工信息显 示到浏览器) package。 import .*。 import .*。 import .*。 import .*。 public class ViewList extends HttpServlet { public synchronized void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { (text/html。 charset=GBK)。 PrintWriter out = ()。 Connection =null。 Statement stmt=null。 ResultSet rs=null。 try{ ()。 String url=jdbc: String user=root。 String password=123456。 =(url,user,password)。 stmt=()。 rs=(select * from stufflist)。 // 通过 response向客户端应答 (html)。 (head)。 (title显示小组 /title)。 (/head)。 (body)。员工管理系统j2ee应用架构与eclipse开发技术课程(编辑修改稿)
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。