毕业设计(论文)
主页代码部分如下: /**取得商品分类列表*/
public String[][] getCategory(){
String[][] options = null;
MerService service = new MerServiceImpl(); try{
List list = service.browseCategory(); Category cate = null; int i = 0; if (list!=null){
options = new String[list.size()][2]; Iterator it = list.iterator(); while(it.hasNext()){ }
cate = (Category)it.next();
options[i][0] =cate.getId().toString(); options[i][1] =cate.getCateName().trim(); i++;
}else{ }
options = new String[1][2]; options[0][0] =\
options[0][1] =\无商品分类\
}catch(Exception ex){
logger.info(\在执行AjaxBean类中的getCategory出错!\
}
ex.printStackTrace();
return options; }
26
毕业设计(论文)
(2)用户注册模块
用户注册是为第一次登录网站的用户所设计的。在用户成为本站用户之前一定要注册才可以访问我网站的其它网页。
①用户注册包括登录名称、真实姓名、设置密码、电子邮件等。 ②注册成功后,才可以访问本站的其他页面。
如图4.2所示。
图4.2 用户注册模块
用户注册页面部分代码如下: //构造会员级别下拉列表
result = jsonrpc.ajax.getMemberLevel(); for (var i=0;i 27 option =document.createElement(\option.value = result[i][0]; option.text = result[i][1]; document.all.memberlevel.options.add(option); 毕业设计(论文) //密码核对 function checkPwd(){ if (document.all.loginPwd.value != document.all.reLoginPwd.value){ } //登录帐号有效性检查 function checkLoginName(){ var lname = document.all.loginName.value; if } alert('对不起,两次输入的密码不一致,请重新输入!'); document.all.loginPwd.value = \document.all.reLoginPwd.value =\document.all.loginPwd.focus(); ((lname !=null)&&(lname.length>0)&&(!jsonrpc.ajax.chkLoginName(lname))){ } alert('对不起,该登录帐号已被占用,请重新输入!'); document.all.loginName.focus(); } (3)用户登录模块 ①用户登录包括登录名称、输入密码。 ②当用户登录后由管理员核对该用户的名称和密码是否正确,如果无误的话用户可以通过检查直接进入网站的其它页面进行浏览和订购。 如图4.3所示。 28 毕业设计(论文) 图4.3 用户登录模块 登录页面部分你代码: /** 用户登录 */ public Member memLogin(String loginName, String loginPwd) throws Exception { Session session = MySessionFactory.getSession(); Transaction tx = null; Member mem = null; try{ String hql = \ a.loginName=:loginName and a.loginPwd=:loginPwd\ Query query = session.createQuery(hql); query.setString(\query.setString(\query.setMaxResults(1); tx = session.beginStation(); mem = (Member)query.uniqueResult(); mem.setLoginTimes(Integer.valueOf(mem.getLoginTimes().intValue()+1)); mem.setLastDate(new Date()); 29 毕业设计(论文) \\n\ session.update(mem); tx.commit(); }catch(Exception ex){ if(tx!=null)tx.rollback(); logger.info(\在执行MemServiceImpl类中的memLogin方法时出错: } ex.printStackTrace(); }finally{ MySessionFactory.closeSession(); } return mem; (4)菜品浏览模块 菜品浏览:成功登陆后的用户可以分页浏览菜品菜品,并将想要的菜品提交到填写订单页面。如图4.4所示。 图4.4 菜品浏览模块 菜品浏览模块部分代码: 30 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库网上订餐系统(7)在线全文阅读。
相关推荐: