java web银行项目
一、项目简介
本项目是基于idea,后台实现的技术:jsp,servlet,前端开发技术:javascript、css、bootstrap本项目主要实现一个模拟ATM机存款、取款、转账功能的一个系统,可以查看打印交易明细,后台用户可以管理用户账户卡信息。本系统主要是针对计算机专业的学生做课程设计或课程期未作业使用。功能完整,界面美观大方。如果你的课程设计或作业是关于ATM机存取款方面的,可以考虑使用。本系统包含完整源码和数据库一份,并配套文档说明一份。有兴趣了解的朋友可以留下联系方式
二:登录界面
<div>
<div class="stu_error_box"></div>
<form action="<%=request.getContextPath()%>/UserLogin" method="post" class="stu_login_error">
<div id="username">
<label>卡 号:</label>
<input type="text" id="stu_username_hide" name="ICNo" placeholder="输入卡号" nullmsg="卡号不能为空!" datatype="s6-18" errormsg="卡号范围在6~18个字符之间!" sucmsg="卡号验证通过!"/>
<!--ajaxurl="demo/valid.jsp"-->
</div>
<div id="password">
<label>密 码:</label>
<input type="password" id="stu_password_hide" name="pwd" placeholder="输入密码" nullmsg="密码不能为空!" datatype="*6-16" errormsg="密码范围在6~16位之间!" sucmsg="密码验证通过!"/>
</div>
<p style="color:red;font-size: 14px" >${error}</p>
<div id="login">
<button type="submit">登录</button>
</div>
</form>
</div>
三、用户展示页面
四、转账功能
五、修改密码
六、存款功能
七、管理员登录界面
八、新增用户
九部分后台代码展示 Servlet部分
package com.atm.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.atm.service.UserService;
import com.atm.service.impl.UserServiceimpl;
public class LoginServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
String name = req.getParameter("name");
String pwd = req.getParameter("password");
System.out.println(name+"----"+pwd);
UserService us = new UserServiceimpl();
int result = us.login(name, pwd, req);
System.out.println(result);
if(result==1){
System.out.println("用户登录成功!");
resp.sendRedirect("list");
}else if(result==0){
System.out.println("用户登录失败");
req.setAttribute("error", "密码错误");
req.getRequestDispatcher("changepage/login.jsp").forward(req, resp);
}else{
System.out.println("LoginServlet.doGet(我是result==其他)");
req.setAttribute("error", "用户名不存在");
req.getRequestDispatcher("changepage/login.jsp").forward(req, resp);
}
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req,resp);
}
}
package com.atm.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.atm.pojo.User;
import com.atm.service.UserService;
import com.atm.service.impl.UserServiceimpl;
/**
* @author lilijian
*
*/
public class SelectServlet extends HttpServlet {
UserService us = new UserServiceimpl();
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
String name = req.getParameter("name");
List<User> list2 = us.showsome(name);
//req.setAttribute("list2", list2);
//req.getServletContext().setAttribute("list2", list2);
req.getSession().setAttribute("list2", list2);
resp.sendRedirect("changepage/userlist.jsp");
//req.getRequestDispatcher("changepage/userlist.jsp").forward(req, resp);
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req,resp);
}
}
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req,resp);
}
}