Java项目:JSP活动报名管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目分为前后台,分为管理员与普通用户两种角色,管理员登录后台,普通用户登录前台;

管理员角色包含以下功能:

管理员登录,修改个人信息,报名管理,游客管理,活动管理,活动类型管理等功能。

用户角色包含以下功能:

按分类查看,用户登录,修改个人信息,查看活动详情,查看我的报名,提交报名,确认报名等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

5.数据库:MySql 5.7版本;

6.是否Maven项目:否;

技术栈

JSP+CSS+jQuery+bootstrap+mysql+servlet

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中src/utils/DBUtil.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/jsp_huodong_fabusys/ 登录 注:tomcat中配置项目路径必须为jsp_huodong_fabusys,否则会有异常;
用户账号/密码:user/123456

管理员账号/密码:admin/admin

运行截图

前台界面

 

 

后台界面

相关代码 

GoodsService

package service;import dao.GoodsDao;
import model.Goods;
import model.Page;
import sun.nio.cs.ext.IBM037;import javax.management.monitor.StringMonitorMBean;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;public class GoodsService {private GoodsDao gDao=new GoodsDao();public List> getGoodsList(int recommendType) {List> list=null;try {list=gDao.getGoodsList(recommendType);} catch (SQLException e) {e.printStackTrace();}return list;}public Map getScrollGood(){Map scroolGood=null;try {scroolGood=gDao.getScrollGood();} catch (SQLException e) {e.printStackTrace();}return scroolGood;}public List selectGoodsByTypeID(int typeID, int pageNumber, int pageSize){List list=null;try {list=gDao.selectGoodsByTypeID(typeID,pageNumber,pageSize);} catch (SQLException e) {e.printStackTrace();}return list;}public Page selectPageByTypeID(int typeID,int pageNumber){Page p=new Page();p.setPageNumber(pageNumber);int totalCount=0;try {totalCount=gDao.getCountOfGoodsByTypeID(typeID);} catch (SQLException e) {e.printStackTrace();}p.SetPageSizeAndTotalCount(8,totalCount);List list=null;try {list=gDao.selectGoodsByTypeID(typeID,pageNumber,8);} catch (SQLException e) {e.printStackTrace();}p.setList(list);return p;}public Page getGoodsRecommendPage(int type,int pageNumber) {Page p = new Page();p.setPageNumber(pageNumber);int totalCount = 0;try {totalCount = gDao.getRecommendCountOfGoodsByTypeID(type);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.SetPageSizeAndTotalCount(8, totalCount);List list=null;try {list = gDao.selectGoodsbyRecommend(type, pageNumber, 8);for(Goods g : (List)list) {g.setScroll(gDao.isScroll(g));g.setHot(gDao.isHot(g));g.setNew(gDao.isNew(g));}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.setList(list);return p;}public Goods getGoodsById(int id) {Goods g=null;try {g = gDao.getGoodsById(id);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return g;}public Page getSearchGoodsPage(String keyword, int pageNumber) {Page p = new Page();p.setPageNumber(pageNumber);int totalCount = 0;try {
//			totalCount = gDao.getGoodsCount(typeId);totalCount = gDao.getSearchCount(keyword);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.SetPageSizeAndTotalCount(8, totalCount);List list=null;try {
//			list = gDao.selectGoods(keyword, pageNo, 8);list = gDao.selectSearchGoods(keyword,pageNumber,8);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.setList(list);return p;}public void addRecommend(int id,int type) {try {gDao.addRecommend(id, type);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void removeRecommend(int id,int type) {try {gDao.removeRecommend(id, type);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void insert(Goods goods) {try {gDao.insert(goods);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void update(Goods goods) {try {gDao.update(goods);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void delete(int id) {try {gDao.delete(id);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
}

UserService

package service;import dao.UserDao;
import model.Page;
import model.User;import java.sql.SQLException;
import java.util.List;public class UserService {private UserDao uDao = new UserDao();public boolean register(User user) {try {if(uDao.isUsernameExist(user.getUsername())) {return false;}if(uDao.isEmailExist(user.getEmail())) {return false;}uDao.addUser(user);return true;} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return false;}public User login(String ue,String password) {User user=null;try {user = uDao.selectByUsernamePassword(ue, password);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}if(user!=null) {return user;}try {user=uDao.selectByEmailPassword(ue, password);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}if(user!=null) {return user;}return null;}public User selectById(int id) {User u=null;try {u = uDao.selectById(id);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return u;}public void updateUserAddress(User user) {try {uDao.updateUserAddress(user);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void updatePwd(User user) {try {uDao.updatePwd(user);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public Page getUserPage(int pageNumber) {Page p = new Page();p.setPageNumber(pageNumber);int pageSize = 7;int totalCount = 0;try {totalCount = uDao.selectUserCount();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.SetPageSizeAndTotalCount(pageSize, totalCount);List list=null;try {list = uDao.selectUserList( pageNumber, pageSize);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.setList(list);return p;}public boolean delete(int id ) {try {uDao.delete(id);return true;} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();return false;}}
}

OrderService

package service;import dao.*;
import model.*;
import utils.*;import java.sql.*;
import java.util.List;public class OrderService {private OrderDao oDao = new OrderDao();public void addOrder(Order order) {Connection con = null;try {con = DBUtil.getConnection();con.setAutoCommit(false);oDao.insertOrder(con, order);int id = oDao.getLastInsertId(con);order.setId(id);for(OrderItem item : order.getItemMap().values()) {oDao.insertOrderItem(con, item);}con.commit();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();if(con!=null)try {con.rollback();} catch (SQLException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}}public List selectAll(int userid){List list=null;try {list = oDao.selectAll(userid);for(Order o :list) {List l = oDao.selectAllItem(o.getId());o.setItemList(l);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return list;}public Page getOrderPage(int status,int pageNumber) {Page p = new Page();p.setPageNumber(pageNumber);int pageSize = 10;int totalCount = 0;try {totalCount = oDao.getOrderCount(status);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.SetPageSizeAndTotalCount(pageSize, totalCount);List list=null;try {list = oDao.selectOrderList(status, pageNumber, pageSize);for(Order o :(List)list) {List l = oDao.selectAllItem(o.getId());o.setItemList(l);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}p.setList(list);return p;}public void updateStatus(int id,int status) {try {oDao.updateStatus(id, status);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void delete(int id) {Connection con = null;try {con = DBUtil.getDataSource().getConnection();con.setAutoCommit(false);oDao.deleteOrderItem(con, id);oDao.deleteOrder(con, id);con.commit();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();if(con!=null)try {con.rollback();} catch (SQLException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}}
}

TypeService

package service;import dao.TypeDao;
import model.Type;import java.sql.SQLException;
import java.util.List;public class TypeService {TypeDao tDao=new TypeDao();public List GetAllType(){List list=null;try {list=tDao.GetAllType();} catch (SQLException e) {e.printStackTrace();}return list;}public Type selectTypeNameByID(int typeid){Type type=null;try {type=tDao.selectTypeNameByID(typeid);} catch (SQLException e) {e.printStackTrace();}return type;}public Type select(int id) {Type t=null;try {t = tDao.select(id);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return t;}public void insert(Type t) {try {tDao.insert(t);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void update(Type t) {try {tDao.update(t);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public boolean delete(int id) {try {tDao.delete(id);return true;} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();return false;}}
}

Goods

package model;public class Goods {private int id;private String name;private String cover;private String image1;private String image2;private float price;private String intro;private int stock;private Type type;private boolean isScroll;private boolean isHot;private boolean isNew;public boolean getIsScroll() {return isScroll;}public void setScroll(boolean isScroll) {this.isScroll = isScroll;}public boolean getIsHot() {return isHot;}public void setHot(boolean isHot) {this.isHot = isHot;}public boolean getIsNew() {return isNew;}public void setNew(boolean isNew) {this.isNew = isNew;}public void setTypeid(int typeid) {if(type==null) {type = new Type();}type.setId(typeid);}public void setTypename(String typename) {if(type==null) {type = new Type();}type.setName(typename);}@Overridepublic String toString() {return "Goods [id=" + id + ", name=" + name + ", cover=" + cover + ", image1=" + image1 + ", image2=" + image2+ ", price=" + price + ", intro=" + intro + ", stock=" + stock + ", type=" + type + "]";}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getCover() {return cover;}public void setCover(String cover) {this.cover = cover;}public String getImage1() {return image1;}public void setImage1(String image1) {this.image1 = image1;}public String getImage2() {return image2;}public void setImage2(String image2) {this.image2 = image2;}public float getPrice() {return price;}public void setPrice(float price) {this.price = price;}public String getIntro() {return intro;}public void setIntro(String intro) {this.intro = intro;}public int getStock() {return stock;}public void setStock(int stock) {this.stock = stock;}public Type getType() {return type;}public void setType(Type type) {this.type = type;}public Goods() {super();}public Goods(int id, String name, String cover, String image1, String image2, float price, String intro, int stock,Type type) {super();this.id = id;this.name = name;this.cover = cover;this.image1 = image1;this.image2 = image2;this.price = price;this.intro = intro;this.stock = stock;this.type = type;}}

如果也想学习本系统,下面领取。关注并回复:040jsp


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部