public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=gb2312"); //定义响应头
PrintWriter out = response.getWriter(); //获取打印流。
CodeChange code=new CodeChange();//实例化一个对象
HttpSession session=request.getSession();//获取当前用户的session
String action=request.getParameter("action");//获取请求的标识,和其他的表单参数没区别
String name=request.getParameter("name");//用户名
String psw=request.getParameter("pwd");//密码
session.setAttribute("name", name);//用户名放到session中
if(action.equals("index")){//判断标识,做出具体的操作
String idStr=request.getParameter("choose");//获取一个前提传过来的值
if(idStr.equals("0")){//验证用户名密码 。0是管理员
if(name.equals("admin")&&psw.equals("admin")){
request.getRequestDispatcher("/adminManager/main.jsp").forward(request, response);//成功后转发到adminManager/main.jsp
}else{
request.getRequestDispatcher("failed.html").forward(request, response);//失败转发到 错误页面
}
}else if(idStr.equals("1")){//1是学生?
StudentInf st=new StudentInf();//实例化一个对象
st.setStu_ID(code.getString(name));//赋值 名字st.setStu_password(code.getString(psw));//赋值 密码
StudentDAO sdao=new StudentDAO();
if(sdao.searchStu(st)){//验证上变的用户,和密码
String stu_ID=st.getStu_ID();
StudentInf stu=sdao.searchStuById(stu_ID);
session.setAttribute("stu_id", code.getString(name));
session.setAttribute("stu_name", stu.getStu_name());
request.getRequestDispatcher("/studentManager/stu_main.jsp").forward(request, response);//验证成功转发
}else{
request.getRequestDispatcher("failed.html").forward(request, response);//失败 转发到错误页面
}
}else{//其他就是教师
TearcherInf ad=new TearcherInf();
ad.setTearcher_ID(code.getString(name));
ad.setPassword(code.getString(psw));
TearcherDAO tdao=new TearcherDAO();
if(tdao.searchTear(ad)){
session.setAttribute("tearcherID", ad.getTearcher_ID());
session.setAttribute("password", ad.getPassword());
request.getRequestDispatcher("/tearcherManager/tearcher_main.jsp").forward(request, response);
}else{//这块没啥用 不会走 。
request.getRequestDispatcher("failed.html").forward(request, response);
}
}
}
}
throws ServletException, IOException {
response.setContentType("text/html;charset=gb2312"); //定义响应头
PrintWriter out = response.getWriter(); //获取打印流。
CodeChange code=new CodeChange();//实例化一个对象
HttpSession session=request.getSession();//获取当前用户的session
String action=request.getParameter("action");//获取请求的标识,和其他的表单参数没区别
String name=request.getParameter("name");//用户名
String psw=request.getParameter("pwd");//密码
session.setAttribute("name", name);//用户名放到session中
if(action.equals("index")){//判断标识,做出具体的操作
String idStr=request.getParameter("choose");//获取一个前提传过来的值
if(idStr.equals("0")){//验证用户名密码 。0是管理员
if(name.equals("admin")&&psw.equals("admin")){
request.getRequestDispatcher("/adminManager/main.jsp").forward(request, response);//成功后转发到adminManager/main.jsp
}else{
request.getRequestDispatcher("failed.html").forward(request, response);//失败转发到 错误页面
}
}else if(idStr.equals("1")){//1是学生?
StudentInf st=new StudentInf();//实例化一个对象
st.setStu_ID(code.getString(name));//赋值 名字st.setStu_password(code.getString(psw));//赋值 密码
StudentDAO sdao=new StudentDAO();
if(sdao.searchStu(st)){//验证上变的用户,和密码
String stu_ID=st.getStu_ID();
StudentInf stu=sdao.searchStuById(stu_ID);
session.setAttribute("stu_id", code.getString(name));
session.setAttribute("stu_name", stu.getStu_name());
request.getRequestDispatcher("/studentManager/stu_main.jsp").forward(request, response);//验证成功转发
}else{
request.getRequestDispatcher("failed.html").forward(request, response);//失败 转发到错误页面
}
}else{//其他就是教师
TearcherInf ad=new TearcherInf();
ad.setTearcher_ID(code.getString(name));
ad.setPassword(code.getString(psw));
TearcherDAO tdao=new TearcherDAO();
if(tdao.searchTear(ad)){
session.setAttribute("tearcherID", ad.getTearcher_ID());
session.setAttribute("password", ad.getPassword());
request.getRequestDispatcher("/tearcherManager/tearcher_main.jsp").forward(request, response);
}else{//这块没啥用 不会走 。
request.getRequestDispatcher("failed.html").forward(request, response);
}
}
}
}
解决方案 »
- js中如何实现一个添加操作对应的方法?主要数据类型问题 简单的使用Document.getElementById().value好像不对吧
- RMB求帮忙改个JS轮播图片代码的尺寸(已经在猪八戒网发布)
- 求教,谁帮我看看这个代码,我JS没有基础,不知道对不对啊
- 请问有谁知道哪有unicode和UTF-8编码表下载吗?
- canvas画图工具 历时一周开发 短小精悍 求PK
- 笨鸟问点菜问题,希望多帮忙!!
- 请教
- 我做了一个层,放在<TD><input></input><div></div></td>里面,它总是出现在INPUT的右边,能让它出现在INPUT的下面吗?
- 关于数字相加精度问题!
- 怎样在网页中做一个文本操作的工具条?
- 传递参数的问题
- 嵌入问题的解决方案!
http://hjw315.com
http://jxhz114.com
http://kuaikanba.com
http://lgdqkj.com
http://lixushk.com
http://meixuanya.com
http://nbfadi.com
http://njaibeike.com
http://qdcems.com
http://shdishuai.com
http://spnlp.com
http://tjysq.com
http://xiduotang.com
http://zbyxs.com
http://zgleyi.com
http://bocaitonger.com
http://bocaitongwe.com
http://bocaitongbb.com
http://bocaitongc.com
http://bocaitongd.com
http://bocaitonge.com
http://bocaitongf.com
http://bocaitonggg.com
http://bocaitongh.com
http://bocaitongjj.com
http://bocaitongll.com
http://bocaitongnn.com
http://bocaitongpp.com
http://bocaitongq.com
http://bocaitongqq.com
http://bocaitongr.com
http://bocaitongrr.com
http://bocaitongss.com
http://bocaitongt.com
http://bocaitongtt.com
http://bocaitonguu.com
http://bocaitongvv.com
http://bocaitongww.com
http://bocaitongxx.com
http://bocaitongy.com
http://bocaitongz.com
http://bocaitongzz.com
http://huangguan139.com
http://huangguan140.com
http://huangguan141.com
http://huangguan142.com
http://huangguan143.com
http://huangguan144.com
http://huangguan146.com
http://huangguan148.com
http://huangguan149.com
http://huangguan150.com
http://huangguan103.com
http://huangguan104.com
http://huangguan105.com
http://huangguan106.com
http://huangguan107.com
http://huangguan109.com
http://huangguan11.com
http://huangguan112.com
http://huangguan121.com
http://huangguan122.com
http://huangguan124.com
http://huangguan126.com
http://huangguan127.com
http://huangguan129.com
http://huangguan130.com
http://huangguan131.com
http://huangguan132.com
http://huangguan133.com
http://huangguan134.com
http://huangguan135.com
http://huangguan136.com
http://huangguan137.com
http://huangguan14.com
http://huangguan18.com
http://huangguan22.com
http://huangguan25.com
http://huangguan3.com
http://huangguan44.com
http://huangguan47.com
http://huangguan54.com
http://huangguan55.com
http://huangguan58.com
http://huangguan6.com
http://huangguan64.com
http://huangguan7.com
http://huangguan84.com
http://huangguan86.com
http://huangguan87.com
http://huangguan92.com
http://huangguan96.com
http://huangguan97.com
http://huangguanx.com
http://huangguanxx.com
http://huangguany.com
http://huangguana.com
http://huangguanb.com
http://huangguanc.com
http://huangguane.com
http://huangguanf.com
http://huangguanh.com
http://huangguani.com
http://huangguanj.com
http://huangguank.com
http://huangguanl.com
http://huangguanm.com
http://huangguann.com
http://huangguano.com
http://huangguanp.com
http://huangguanq.com
http://huangguanr.com
http://huangguant.com
http://huangguanu.com
http://huangguanv.com
http://huangguanwangp.com
http://huangguanwangu.com
http://badengguojiyulecheng.com
http://hong9guojiyulecheng.com
http://ouhuaguojiyulecheng.com
http://ceoyulechengchang.com
http://youtinghuiyulecheng3.com
http://yuanhuayulecheng2.com
http://yubianhuiyulecheng55.com
http://yueliangchengyulecheng1.com
http://yulechengkaihu2.com
http://yundingyulecheng1.com
http://yundingyulecheng4.com
http://yyyulecheng5.com
http://zhanshenyulecheng3.com
http://zhengdayulecheng2.com
http://zhizunyulecheng1.com
http://zhongdongyulecheng2.com
http://zhongyuanyulecheng78.com
http://zhuangyuanyulecheng4.com
http://zongtongyulecheng12.com
http://zuanshiyulecheng1.com
http://zuijiayulecheng1.com
http://zunlongyulecheng2.com
http://xingqibayulecheng2.com
http://xinhaofengyulecheng5.com
http://xiniyulecheng2.com
http://xinjinjiangyulecheng3.com
http://xinjinshayulecheng2.com
http://xinliyulecheng2.com
http://xinmengxiangyulecheng2.com
http://xinpujingyulecheng111.com
http://xinshidaiyulecheng55.com
http://xinshijiyulecheng23.com
http://xintaiyangchengyulecheng1.com
http://xinxilanyulecheng3.com
http://xinxinyulecheng3.com
http://xinyuyulecheng2.com
http://xiongdiyulecheng8.com
http://yaojiyulecheng23.com
http://yatelandisiyulecheng3.com
http://yazhouyulecheng3.com
http://yezonghuiyulecheng8.com
http://yidaiyulecheng2.com
http://yifayulecheng1.com
http://yingfengyulecheng2.com
http://yinghuangyulecheng3.com
http://yinlianyulecheng2.com
http://yitongyulecheng5.com
http://yongliyulecheng33.com
http://yonglongyulecheng2.com
http://yongwangyulecheng2.com
http://youboyulecheng55.com
http://wanbaoluyulecheng3.com
http://wandayulecheng2.com
http://wangpaiyulecheng1.com
http://wangshangyulecheng1.com
http://wangziyulecheng11.com
http://wanhaoyulecheng5.com
http://wanrenmiyulecheng3.com
http://weiduoliyayulecheng11.com
http://weilongyulecheng3.com
http://weinisirenyulecheng11.com
http://weiyenayulecheng1.com
http://weiyiboyulecheng1.com
http://wufayulecheng2.com
http://wuhusihaiyulecheng2.com
http://wuxingyulecheng11.com
http://xianggelilayulecheng9.com
http://xianhezhuangyulecheng1.com
http://xiaoyaofangyulecheng7.com
http://xidayulecheng4.com
http://xierdunyulecheng5.com
http://xilaidengyulecheng7.com
http://xiliyulecheng2.com
http://xin2yulecheng12.com
http://xinaoboyulecheng7.com
http://xindaluyulecheng3.com
http://xindongfangyulecheng3.com
http://xindongtaiyulecheng5.com
http://xingjiyulecheng3.com
http://xingqi8yulecheng4.com
http://shenzhouyulecheng5.com
http://shijiayulecheng2.com
http://shijiebeiyulecheng2.com
http://shiliupuyulecheng11.com
http://shisanzhangyulecheng11.com
http://shishiboyulecheng55.com
http://shouxiyulecheng5.com
http://shuijingchengyulecheng2.com
http://suoleieryulecheng9.com
http://suoluomenyulecheng5.com
http://taiziyulecheng23.com
http://tangrenjieyulecheng7.com
http://taobaoboyulecheng11.com
http://tianboyulecheng3.com
http://tianchengyulecheng1.com
http://tianjiangyulecheng2.com
http://tiankongyulecheng3.com
http://tianlongyulecheng1.com
http://tianlongyulechenghuangguanwang1.com
http://tianmaoyulecheng5.com
http://tianshangrenjianyulecheng6.com
http://tiantangniaoyulecheng7.com
http://tiantianleyulecheng8.com
http://tiantianyulecheng2.com
http://tianwangyulecheng5.com
http://tonghuashunyulecheng11.com
http://ttyulecheng67.com
http://tushanyulecheng1.com
http://qianyiyulecheng7.com
http://qijiyulecheng3.com
http://qipaiyulecheng1.com
http://qipilangyulecheng11.com
http://quaomenyulecheng3.com
http://renniboyulecheng1.com
http://ruifengyulecheng1.com
http://ruishiyulecheng5.com
http://sanguoyulecheng3.com
http://sanxingyulecheng22.com
http://sanyayulecheng11.com
http://shengdayulecheng7.com
http://shengdeyulecheng1.com
http://shengtaoshayulecheng22.com
http://shenhuayulecheng22.com
http://nuobeieryulecheng3.com
http://nvshenyulecheng5.com
http://nvyouyulecheng1.com
http://ouhuayulecheng1.com
http://oukaiyulecheng1.com
http://ouzhouyulecheng2.com
http://pukewangyulecheng3.com
http://qianguiyulecheng1.com
http://longchengyulecheng2.com
http://lukesuoyulecheng3.com
http://luofugongyulecheng5.com
http://luokeyulecheng3.com
http://luomayulecheng8.com
http://luyishisanyulecheng8.com
http://madeliyulecheng3.com
http://makeboluoyulecheng5.com
http://manhadunyulecheng6.com
http://mapaiyulecheng6.com
http://meigaomeiyulecheng3.com
http://menghuanchengyulecheng1.com
http://mengtekaluoyulecheng7.com
http://milanyulecheng2.com
http://mingshengyulecheng1.com
http://mingshiyulecheng3.com
http://mingzhuyulecheng2.com
http://miqilinyulecheng3.com
http://moerbenyulecheng5.com
http://monageyulecheng3.com
http://mudanyulecheng3.com
http://muxingyulecheng3.com
http://niaochaoyulecheng3.com
http://niuyueyulecheng2.com
http://kaixuanmenyulecheng12.com
http://kakawanyulecheng3.com
http://kelakeyulecheng2.com
http://kenboyulecheng1.com
http://kongchengchengshiyulecheng1.com
http://kongjunyihaoyulecheng5.com
http://ktvyulecheng3.com
http://kuaihuoyulecheng1.com
http://lanbaoshiyulecheng2.com
http://lanbojiniyulecheng5.com
http://languifangyulecheng4.com
http://laokyulecheng7.com
http://laolishiyulecheng7.com
http://laoqianzhuangyulecheng5.com
http://lasiweijiasiyulecheng5.com
http://lebaijiayulecheng3.com
http://lebaoyulecheng2.com
http://letiantangyulecheng1.com
http://letianyulecheng3.com
http://lezhongleyulecheng4.com
http://liaoyulecheng23.com
http://liboyulecheng2.com
http://ligaoyulecheng1.com
http://lijiboyulecheng2.com
http://lilaiyulecheng1.com
http://lixingyulecheng3.com
http://longboyulecheng2.com
http://jingchengyulecheng3.com
http://jinguangdadaoyulecheng5.com
http://jinguanyulecheng23.com
http://jinhaianyulecheng5.com
http://jinhuayulecheng7.com
http://jinjieyulecheng1.com
http://jinlongyulecheng7.com
http://jinmantangyulecheng22.com
http://jinmayulecheng3.com
http://jinmumianyulecheng22.com
http://jinqianbaoyulecheng7.com
http://jinshayulecheng1.com
http://jinyindaoyulecheng5.com
http://jinyuyulecheng5.com
http://jinzanyulecheng6.com
http://jinzitayulecheng5.com
http://jiujinshanyulecheng11.com
http://jiuzhouyulecheng33.com
http://jizhoudaoyulecheng5.com
http://jjyulecheng11.com
http://jubaopenyulecheng4.com
http://junyiyulecheng3.com
http://juxingyulecheng3.com
http://k7yulecheng22.com
http://kadilayulecheng2.com
http://kaishiyulecheng3.com
http://kaisiyulecheng1.com
http://huangjiajinbaoyulecheng6.com
http://huangmayulecheng1.com
http://huangshiyulecheng2.com
http://huanleguyulecheng9.com
http://huanqiuyulecheng33.com
http://huaqiaorenyulecheng3.com
http://huashengdunyulecheng7.com
http://huaxiayulecheng1.com
http://huboyulecheng1.com
http://huifengyulecheng6.com
http://huihuangyulecheng1.com
http://huiliyulecheng3.com
http://jiaduobaoyulecheng9.com
http://jiaheyulecheng3.com
http://jiangjunyulecheng8.com
http://jiangshanyulecheng3.com
http://jianianhuayulecheng11.com
http://jiazhouyulecheng7.com
http://jiebaoyulecheng3.com
http://jiliyulecheng5.com
http://jinbaiyiyulecheng1.com
http://jinbangyulecheng7.com
http://jinbaoboyulecheng1.com
http://jinboshiyulecheng11.com
http://jincaiyulecheng3.com
http://jindouyulecheng1.com
http://falaliyulecheng5.com
http://fazhongfayulecheng3.com
http://fenghuangyulechengyulecheng1.com
http://fubusiyulecheng3.com
http://g3yulecheng5.com
http://gaodianyulecheng1.com
http://gaoerfuyulecheng5.com
http://gongfuyulecheng5.com
http://gonghaiduchuanyulecheng1.com
http://guangfayulecheng2.com
http://guizuyulecheng23.com
接受4个前台的参数action,name,pwd,choos
把name存入session里
如果action==index
判断choose是否是0,判断是否是admin登录,
如果是admin登录跳到adminManager/main.jsp否则跳到错误页面
choose是1跳到根据id查找这个student判断在跳到("/studentManager/stu_main.jsp,并存入session中
如果是老师查找teach存入session跳转("/tearcherManager/tearcher_main.jsp
,
这是你业务层的代码,主要是看你业务中要做什么功能!!