176142998

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            116 Posts :: 0 Stories :: 45 Comments :: 0 Trackbacks
          //dao注入
          private static String hqlname = "from User u where u.name=?";
           private static String hqlpassword = "from User u where u.password=?";

          public boolean isValidUser(String one,int i){
            List userList;
            if(i==0){
              userList=this.getHibernateTemplate().find(hqlname+"",one);
            }else{
              userList=this.getHibernateTemplate().find(hqlpassword+"",one);
             
            }
            if (userList.size() > 0) {
             return true;
            }
            
            return false;
            
           }


          //action

            if(userDao.isValidUser(name, password)){
             
             //return mapping.findForward("welcome");
             return new ActionForward("/pages/welcome.jsp");
            }else{
             
             ActionMessages message = new ActionMessages();
             
             if(userDao.isValidUser(name,0)){
              
             }else{
              message.add("name",new ActionMessage("name.error",true));
             }
             if(userDao.isValidUser(password,1)){
              
             }else{
              message.add("password",new ActionMessage("password.error",true));
             }

             this.saveErrors(request,message);
             //return new ActionForward("/pages/login.jsp");
             return mapping.findForward("welcome");
            }

          posted on 2008-07-31 16:15 飛飛 閱讀(339) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 拜城县| 武乡县| 拜泉县| 河南省| 石家庄市| 清徐县| 赞皇县| 日土县| 绥阳县| 景东| 阜平县| 海淀区| 安新县| 申扎县| 遵义县| 沂水县| 洞头县| 民和| 柳州市| 衢州市| 个旧市| 溧阳市| 庄浪县| 顺昌县| 宁强县| 乌拉特后旗| 冀州市| 卫辉市| 封开县| 综艺| 岳西县| 忻城县| 兴安县| 青神县| 万全县| 海林市| 团风县| 梅州市| 灌云县| 阿尔山市| 汾阳市|