毕业论文-07210306-曹圣驹-基于JAVA技术的个人网上银行系统的设计与实现 下载本文

4.3.2 登录

主要代码如下:

HttpSession session=request.getSession(); if(request.getAttribute(\ }

//对用户进行判断

request.removeAttribute(\

if(user!=null){

session.setAttribute(\ return mapping.findForward(\ }else{

//用户登录失败则给出错误提示

String error=\帐户号码或密码错误,请重新登录!\ request.setAttribute(\ return mapping.findForward(\

21

4.3.3 查询

查询这显示数据库中该用户的信息,如下图:

4.3.4 转账 主要代码如下:

if(action.equals(\

double money=Double.parseDouble(request.getParameter(\String accountID2=request.getParameter(\if(c.getBalance()-money<0){ }

22

//转账金额比余额小

request.setAttribute(\余额不足\return mapping.findForward(\

Customer c2=TradeService.find(accountID2); if(c2==null){

//

request.setAttribute(\转帐帐号错误或不存在\return mapping.findForward(\

}else{

TradeService.zhuanzhang(c.getAccountID(),c2.getAccountID(),

money);

//转账完毕改变余额

}

c.setBalance(c.getBalance()-money); session.setAttribute(\

4.3.5 取款

主要代码如下:

if(action.equals(\

double money=Double.parseDouble(request.getParameter(\if(c.getBalance()-money<0){

23

}

request.setAttribute(\余额不足\return mapping.findForward(\

TradeService.qukuan(c.getAccountID(), money); c.setBalance(c.getBalance()-money); session.setAttribute(\

4.3.6 修改账户信息

主要代码如下:

if(action.equals(\

c.setUserName(request.getParameter(\c.setSex(request.getParameter(\c.setCardID(request.getParameter(\

24