精华内容
下载资源
问答
  • javaweb投票系统的制作
    2021-01-02 07:32:06

     

    目录

     

    0、效果展示

    1、概述

    2、搭建环境

    3、数据表结构

    ​4、后端代码示例

    5、前端代码示例


     

    0、效果展示

     

     

    1、概述

     

     

    通过问卷调查信息化平台,可以实现信息化的网络化管理,形成一个及时更新的数据中心和信息管理平台,全面、实时、准确提供问卷调查的有关信息,为用户提供辅助支持,为管理人员开展工作提供极大的便利。该系统主要实现了发布人:问卷添加、问卷管理、问卷统计、信息修改、注册、登录、留言板;浏览答题者:浏览问卷、回答问卷、公告查看;后台管理员:修改密码、管理员管理、订单管理、问卷管理、问卷分类管理、发布人管理、公告管理、留言管理。

    2、搭建环境

     

    本文以实现一个问卷投票调查网站为目标,从环境搭建到编码实现全过程讲述

    我们使用javaweb、J2EE来构建问卷投票调查网站,环境使用最新版jdk和tomcat,配合mysql数据库

    开发工具使用idea(也可以使用eclipse),数据库管理工具使用Navicat Premium 

    开发框架使用JavaBean Servlet MVC结构;

    没有使用SSH(Struts+Spring+Hibernate)或SSM(Spring+SpringMVC+MyBatis),这两个框架我们在别的项目中再介绍开发过程

     

    在项目中会引入My97DatePicker作为前端日期时间选择工具,使用fckeditor作为富媒体编辑器(也可以使用百度的ueditor)

     

     

     

    3、数据表结构

     

    7 t_timu题目表

    字段名称

    自动增长

    字段类型

    说明

    id

    -

    int

    编号

    name

    -

    text

    名称

    xuanxianga

    -

    text

    选项

    xuanxiangb

    -

    text

    选项

    xuanxiangc

    -

    text

    选项

    xuanxiangd

    -

    text

    选项

    daan

    -

    text

    答案

    fenshu

    -

    int

    分数

    del

    -

    varchar

    是否删除

    type

    -

    text

    分类

    userid

    -

    int

    用户ID

     8 t_wenjuan 问卷

    字段名称

    自动增长

    字段类型

    说明

    id

    -

    int

    编号

    title

    -

    text

    标题

    shijian

    -

    text

    日期

    type

    -

    text

    类型

    content

    -

    text

    内容

    del

    -

    text

    是否删除

    userid

    -

    text

    用户ID

     

    ​4、后端代码示例

     

      

    package com.action;
    
    import java.io.IOException;
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.dao.DB;
    import com.orm.Tputuser;
    import com.orm.Ttimu;
    import com.orm.Twenjuan;
    import com.service.liuService;
    
    public class wenjuan_servlet extends HttpServlet
    {
    	public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException 
    	{
            String type=req.getParameter("type");
    		
    		
    		if(type.endsWith("wenjuanAdd"))
    		{
    			wenjuanAdd(req, res);
    		}
    		if(type.endsWith("wenjuanMana"))
    		{
    			wenjuanMana(req, res);
    		}
    		if(type.endsWith("wenjuanDel"))
    		{
    			wenjuanDel(req, res);
    		}
    		if(type.endsWith("wenjuanDelByUser"))
    		{
    			wenjuanDelByUser(req, res);
    		}
    		if(type.endsWith("wenjuanDetail"))
    		{
    			wenjuanDetail(req, res);
    		}
    		if(type.endsWith("wenjuanAll"))
    		{
    			wenjuanAll(req, res);
    		}
    		if(type.endsWith("wenjuanDetailQian"))
    		{
    			wenjuanDetailQian(req, res);
    		}
    		
    		if(type.endsWith("wenjuanTotal"))
    		{
    			wenjuanTotal(req, res);
    		}
    		
    		if(type.endsWith("wenjuanTotalJs"))
    		{
    			wenjuanTotalJs(req, res);
    		}
    		
    		if(type.endsWith("wenjuanByUser"))
    		{
    			wenjuanByUser(req, res);
    		}
    		
    	}
    	
    	
    	public void wenjuanAdd(HttpServletRequest req,HttpServletResponse res)
    	{
    		String id=String.valueOf(new Date().getTime());
    		String title=req.getParameter("title");
    		String type_id=req.getParameter("fenlei_id");
    		String content=req.getParameter("content");
    		String userid=req.getParameter("userid");
    		
    	 	String shijian=req.getParameter("shijian");
    	 	String gqdate=req.getParameter("gqdate");
    		String del="no";
    		
    		String sql="insert into t_wenjuan values(?,?,?,?,?,?,?,?)";
    		Object[] params={null,title,shijian,type_id,content,del,userid,gqdate};
    		DB mydb=new DB();
    		mydb.doPstm(sql, params);
    		mydb.closed();
    		
    		req.setAttribute("message", "操作成功");
    		req.setAttribute("path", "wenjuan?type=wenjuanByUser&userid="+userid);
    		
            String targetURL = "/common/success.jsp";
    		dispatch(targetURL, req, res);
            
    	}
    	public void wenjuanDelByUser(HttpServletRequest req,HttpServletResponse res)
    	{
    		int id=Integer.parseInt(req.getParameter("id"));
    		
    		String sql="delete from t_wenjuan where id=?";
    		Object[] params={id};
    		DB mydb=new DB();
    		mydb.doPstm(sql, params);
    		mydb.closed();
    		HttpSession session=req.getSession();
    		Tputuser putuser=(Tputuser)session.getAttribute("putuser");
    		
    		req.setAttribute("message", "操作成功");
    		req.setAttribute("path", "wenjuan?type=wenjuanByUser&userid="+putuser.getId());
    		
            String targetURL = "/common/success.jsp";
    		dispatch(targetURL, req, res);
    	}
    	
    	
    	 
    	
    	public void wenjuanDel(HttpServletRequest req,HttpServletResponse res)
    	{
    		String id=req.getParameter("id");
    		
    		String sql="delete from t_wenjuan where id=?";
    		Object[] params={id};
    		DB mydb=new DB();
    		mydb.doPstm(sql, params);
    		mydb.closed();
    		
    		req.setAttribute("message", "操作成功");
    		req.setAttribute("path", "wenjuan?type=wenjuanMana");
    		
            String targetURL = "/common/success.jsp";
    		dispatch(targetURL, req, res);
    	}
    	
    	public void wenjuanDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String id=req.getParameter("id");
    		
    		Twenjuan wenjuan=new Twenjuan();
    		String sql="select * from t_wenjuan where id=?";
    		Object[] params={id};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			rs.next();
    			wenjuan.setId(rs.getString("id"));
    			wenjuan.setTitle(rs.getString("title"));
    			wenjuan.setContent(rs.getString("content"));
    			wenjuan.setUser_id(rs.getInt("userid"));
    			wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    			wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("wenjuan", wenjuan);
    		req.getRequestDispatcher("admin/wenjuan/wenjuanDetail.jsp").forward(req, res);
    	}
    	
    	
    	
    	
    	public void wenjuanTotalJs(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String id=req.getParameter("id");
    		
    		Twenjuan wenjuan=new Twenjuan();
    		String sql="select * from t_wenjuan where id=?";
    		Object[] params={id};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			rs.next();
    			wenjuan.setId(rs.getString("id"));
    			wenjuan.setTitle(rs.getString("title"));
    			wenjuan.setContent(rs.getString("content"));
    		 	wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setUser_id(rs.getInt("userid"));
    				wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    					
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		
    	    String wenjuanid=req.getParameter("id");
    			
    		 	
    	
    	    List timuList=new ArrayList();
    		  
    	 	
    		  String sql1="select * from t_timu_wenjuan where wenjuan_id=?  ";
    		Object[] params1={wenjuanid};
    			 
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    				
    				
    		    String sql11="select   count(*) as gs,IFNULL(daan,'未回答') as daan from t_timu_user where timu_id="+rs.getInt("timu_id")+" and wenjuan_id="+wenjuanid+" GROUP BY daan";
    		Object[] params11={};
    			 
    		    DB mydb11=new DB();
    		 
    			mydb11.doPstm(sql11, params11);
    			ResultSet rs1=mydb11.getRs();
    			while(rs1.next())
    			{
    			    Ttimu timu=new Ttimu();
    	
    				timu.setName(liuService.getTimuName(rs.getInt("timu_id")));
    				timu.setDaan(rs1.getString("daan"));
    				timu.setFenshu(rs1.getInt("gs"));
    				
    				System.out.println(timu.getName());
    				timuList.add(timu);
    				
    			}
    				
    				
    		    }
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("timuList", timuList);
    		
    		req.setAttribute("wenjuan", wenjuan);
    		req.getRequestDispatcher("qiantai/wenjuan/wenjuanTotalJs.jsp").forward(req, res);
    	}
    
    
    
    	
    	
    	
    	
    	public void wenjuanDetailQian(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String id=req.getParameter("id");
    		
    		Twenjuan wenjuan=new Twenjuan();
    		String sql="select * from t_wenjuan where id=?";
    		Object[] params={id};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			rs.next();
    			wenjuan.setId(rs.getString("id"));
    			wenjuan.setTitle(rs.getString("title"));
    			wenjuan.setContent(rs.getString("content"));
    		 	wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setUser_id(rs.getInt("userid"));
    				wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    					
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		
    	    String wenjuanid=req.getParameter("id");
    			
    		 	
    	
    		
    		
    		List timuList=new ArrayList();
    	    String sql1="select * from t_timu_wenjuan where wenjuan_id=?  ";
    		Object[] params1={wenjuanid};
    			 
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    			 
    				timuList.add(liuService.getTimuById(rs.getInt("timu_id")));
    		    }
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("timuList", timuList);
    		
    		req.setAttribute("wenjuan", wenjuan);
    		req.getRequestDispatcher("qiantai/wenjuan/wenjuanDetailQian.jsp").forward(req, res);
    	}
    
    
    
    	public void wenjuanMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String page1=req.getParameter("page");
    		if(page1==null){
    			page1="1";
    		}
    		//分页设置
    		int EVERYPAGENUM=20;//每页条数
    		int page=Integer.parseInt(page1);   //传递过来的当前页
    		int cou = 1;//得到信息总数	
    		int pagecount=1;  //总页数
    		String sql1="select count(*) as cou from t_wenjuan where del='no'";
    		if(req.getParameter("name")!=null)sql1+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		Object[] params1={};
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    			cou= rs.getInt("cou");
    			}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb1.closed();
    		
    		
    		
    		if (cou % EVERYPAGENUM == 0) {
    			pagecount= cou / EVERYPAGENUM;
            } else {
            	pagecount=cou / EVERYPAGENUM + 1;
            }	
    		
    		
    		
    		req.setAttribute("EVERYPAGENUM", EVERYPAGENUM);	
    		req.setAttribute("page", page);
    		req.setAttribute("cou", cou);
    		req.setAttribute("pagecount", pagecount);
    		
    		
    		List wenjuanList=new ArrayList();
    		String sql="select * from t_wenjuan where del='no'";
    		if(req.getParameter("name")!=null)sql+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		sql+=" order by id desc";
    		Object[] params={};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			 for (int i = 0; i < (page - 1) * EVERYPAGENUM; i++) {
    	                rs.next();
    	            }
    	            for (int t = 0; t < EVERYPAGENUM; t++) {
    	                if (rs.next()) {
    				Twenjuan wenjuan=new Twenjuan();
    				
    				wenjuan.setId(rs.getString("id"));
    				wenjuan.setTitle(rs.getString("title"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setContent(rs.getString("content"));
    				 wenjuan.setShijian(rs.getString("shijian"));
    					wenjuan.setUser_id(rs.getInt("userid"));
    					wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    					
    				wenjuanList.add(wenjuan);
    	                } else {
    	                    break; //减少空循环的时间
    	                }
    				}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("wenjuanList", wenjuanList);
    		req.getRequestDispatcher("admin/wenjuan/wenjuanMana.jsp").forward(req, res);
    	}
    	
    	
    	
    	
    	//前台按用户 
    	public void wenjuanByUser(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String userid=req.getParameter("userid");
    		String page1=req.getParameter("page");
    		if(page1==null){
    			page1="1";
    		}
    		//分页设置
    		int EVERYPAGENUM=20;//每页条数
    		int page=Integer.parseInt(page1);   //传递过来的当前页
    		int cou = 1;//得到信息总数	
    		int pagecount=1;  //总页数
    		String sql1="select count(*) as cou from t_wenjuan where del='no' and userid="+userid+"";
    		if(req.getParameter("name")!=null)sql1+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		Object[] params1={};
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    			cou= rs.getInt("cou");
    			}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb1.closed();
    		
    		
    		
    		if (cou % EVERYPAGENUM == 0) {
    			pagecount= cou / EVERYPAGENUM;
            } else {
            	pagecount=cou / EVERYPAGENUM + 1;
            }	
    		
    		req.setAttribute("EVERYPAGENUM", EVERYPAGENUM);	
    		req.setAttribute("page", page);
    		req.setAttribute("cou", cou);
    		req.setAttribute("pagecount", pagecount);
    		
    		
    		
    		List wenjuanList=new ArrayList();
    		String sql="select * from t_wenjuan where del='no' and userid="+userid+"";
    		if(req.getParameter("name")!=null)sql+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		sql+=" order by id desc";
    		Object[] params={};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			 for (int i = 0; i < (page - 1) * EVERYPAGENUM; i++) {
    	                rs.next();
    	            }
    	            for (int t = 0; t < EVERYPAGENUM; t++) {
    	                if (rs.next()) {
    				Twenjuan wenjuan=new Twenjuan();
    
    				wenjuan.setId(rs.getString("id"));
    				wenjuan.setTitle(rs.getString("title"));
    				wenjuan.setContent(rs.getString("content"));
    				wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setUser_id(rs.getInt("userid"));
    				wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    				wenjuan.setGqdate(rs.getString("gqdate"));
    				wenjuanList.add(wenjuan);
    	                } else {
    	                    break; //减少空循环的时间
    	                }
    				}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("userid", userid);
    		req.setAttribute("wenjuanList", wenjuanList);
    		req.getRequestDispatcher("qiantai/wenjuan/wenjuanByUser.jsp").forward(req, res);
    	}
    	
    	
    	
    	//前台按用户统计 
    	public void wenjuanTotal(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String userid=req.getParameter("userid");
    		String page1=req.getParameter("page");
    		if(page1==null){
    			page1="1";
    		}
    		//分页设置
    		int EVERYPAGENUM=20;//每页条数
    		int page=Integer.parseInt(page1);   //传递过来的当前页
    		int cou = 1;//得到信息总数	
    		int pagecount=1;  //总页数
    		String sql1="select count(*) as cou from t_wenjuan where del='no' and userid="+userid+"";
    		if(req.getParameter("name")!=null)sql1+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		Object[] params1={};
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    			cou= rs.getInt("cou");
    			}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb1.closed();
    		
    		
    		
    		if (cou % EVERYPAGENUM == 0) {
    			pagecount= cou / EVERYPAGENUM;
            } else {
            	pagecount=cou / EVERYPAGENUM + 1;
            }	
    		
    		req.setAttribute("EVERYPAGENUM", EVERYPAGENUM);	
    		req.setAttribute("page", page);
    		req.setAttribute("cou", cou);
    		req.setAttribute("pagecount", pagecount);
    		
    		
    		
    		List wenjuanList=new ArrayList();
    		String sql="select * from t_wenjuan where del='no' and userid="+userid+"";
    		if(req.getParameter("name")!=null)sql+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		sql+=" order by id desc";
    		Object[] params={};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			 for (int i = 0; i < (page - 1) * EVERYPAGENUM; i++) {
    	                rs.next();
    	            }
    	            for (int t = 0; t < EVERYPAGENUM; t++) {
    	                if (rs.next()) {
    				Twenjuan wenjuan=new Twenjuan();
    
    				wenjuan.setId(rs.getString("id"));
    				wenjuan.setTitle(rs.getString("title"));
    				wenjuan.setContent(rs.getString("content"));
    				wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setUser_id(rs.getInt("userid"));
    				wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    				
    				wenjuanList.add(wenjuan);
    	                } else {
    	                    break; //减少空循环的时间
    	                }
    				}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("userid", userid);
    		req.setAttribute("wenjuanList", wenjuanList);
    		req.getRequestDispatcher("qiantai/wenjuan/wenjuanTotal.jsp").forward(req, res);
    	}
    	
    	
    	
    	
    	
    	//前台按分类显示 
    	public void wenjuanAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    	{
    		String fenleiid=req.getParameter("fenleiid");
    		String page1=req.getParameter("page");
    		if(page1==null){
    			page1="1";
    		}
    		//分页设置
    		int EVERYPAGENUM=20;//每页条数
    		int page=Integer.parseInt(page1);   //传递过来的当前页
    		int cou = 1;//得到信息总数	
    		int pagecount=1;  //总页数
    		String sql1="select count(*) as cou from t_wenjuan where del='no' and type="+fenleiid+"  and  UNIX_TIMESTAMP(gqdate)>UNIX_TIMESTAMP()";
    		if(req.getParameter("name")!=null)sql1+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		Object[] params1={};
    		DB mydb1=new DB();
    		try
    		{
    			mydb1.doPstm(sql1, params1);
    			ResultSet rs=mydb1.getRs();
    			while(rs.next())
    			{
    			cou= rs.getInt("cou");
    			}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb1.closed();
    		
    		
    		
    		if (cou % EVERYPAGENUM == 0) {
    			pagecount= cou / EVERYPAGENUM;
            } else {
            	pagecount=cou / EVERYPAGENUM + 1;
            }	
    		
    		req.setAttribute("EVERYPAGENUM", EVERYPAGENUM);	
    		req.setAttribute("page", page);
    		req.setAttribute("cou", cou);
    		req.setAttribute("pagecount", pagecount);
    		
    		
    		
    		List wenjuanList=new ArrayList();
    		//String sql="select * from t_wenjuan where del='no' and type="+fenleiid+"  and  UNIX_TIMESTAMP(gqdate)>UNIX_TIMESTAMP() ";
    		String sql="select * from t_wenjuan where del='no' and type="+fenleiid+"     ";
    		if(req.getParameter("name")!=null)sql+=" and title like '%"+req.getParameter("name").trim()+"%'";
    		sql+=" order by id desc";
    		Object[] params={};
    		DB mydb=new DB();
    		try
    		{
    			mydb.doPstm(sql, params);
    			ResultSet rs=mydb.getRs();
    			 for (int i = 0; i < (page - 1) * EVERYPAGENUM; i++) {
    	                rs.next();
    	            }
    	            for (int t = 0; t < EVERYPAGENUM; t++) {
    	                if (rs.next()) {
    				Twenjuan wenjuan=new Twenjuan();
    
    				wenjuan.setId(rs.getString("id"));
    				wenjuan.setTitle(rs.getString("title"));
    				wenjuan.setContent(rs.getString("content"));
    				wenjuan.setShijian(rs.getString("shijian"));
    				wenjuan.setType_id(rs.getInt("type"));
    				wenjuan.setType_name(liuService.getTypeName(rs.getInt("type")));
    				wenjuan.setUser_id(rs.getInt("userid"));
    				wenjuan.setUser_name(liuService.getPutuserName(rs.getInt("userid")));
    				
    				wenjuanList.add(wenjuan);
    	                } else {
    	                    break; //减少空循环的时间
    	                }
    				}
    			rs.close();
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		mydb.closed();
    		
    		req.setAttribute("fenleiid", fenleiid);
    		req.setAttribute("wenjuanList", wenjuanList);
    		req.getRequestDispatcher("qiantai/wenjuan/wenjuanAll.jsp").forward(req, res);
    	}
    	
    	public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response) 
    	{
    		RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
    		try 
    		{
    		    dispatch.forward(request, response);
    		    return;
    		} 
    		catch (ServletException e) 
    		{
                        e.printStackTrace();
    		} 
    		catch (IOException e) 
    		{
    			
    		    e.printStackTrace();
    		}
    	}
    	public void init(ServletConfig config) throws ServletException 
    	{
    		super.init(config);
    	}
    	
    	public void destroy() 
    	{
    		
    	}
    }
    

     

    5、前端代码示例

    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
    <%@ page isELIgnored="false" %> 
    <%
    String path = request.getContextPath();
    %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<meta http-equiv="pragma" content="no-cache" />
    		<meta http-equiv="cache-control" content="no-cache" />
    		<meta http-equiv="expires" content="0" />
    		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
    		<meta http-equiv="description" content="This is my page" />
    
    		<link rel="stylesheet" type="text/css" href="<%=path %>/css/base.css" />
    		
    		<script type="text/javascript" src="<%=path %>/js/popup.js"></script>
    		
            <script language="javascript">
               function timuAll(userid,wenjuanid)
               {
                    var url="<%=path %>/timu?type=timuAll&userid="+userid+"&wenjuanid="+wenjuanid;
                    var pop=new Popup({ contentType:1,isReloadOnClose:false,width:500,height:300});
    	            pop.setContent("contentUrl",url);
    	            pop.setContent("title","题目选择");
    	            pop.build();
    	            pop.show();
               }
               
               function timuByWenjuan(wenjuanid)
               {
                    var url="<%=path %>/timu?type=timuByWenjuan&wenjuanid="+wenjuanid;
                    var pop=new Popup({ contentType:1,isReloadOnClose:false,width:500,height:300});
    	            pop.setContent("contentUrl",url);
    	            pop.setContent("title","题目明细");
    	            pop.build();
    	            pop.show();
               }
               
           </script>
    		<script language="JavaScript" src="<%=path %>/js/public.js" type="text/javascript"></script>
    		
            <script language="javascript">
               function wenjuanAdd()
               {
                  var url="<%=path %>/admin/wenjuan/wenjuanAdd.jsp";
                  window.location.href=url;
               }
               
               function wenjuanDetail(id)
               {
                     var url="<%=path %>/wenjuan?type=wenjuanDetail&id="+id;
                     var n="";
                     var w="500px";
                     var h="400px";
                     var s="resizable:no;help:no;status:no;scroll:yes";
    				 window.location.href=url;
               }
               
                function down1(fujianPath,fujianYuashiMing)
               {
                   var url="<%=path %>/updown/updown.jsp?fujianPath="+fujianPath+"&fujianYuashiMing="+fujianYuashiMing;
    		       url=encodeURI(url); 
                   url=encodeURI(url); 
                   window.open(url,"_self");
               }
           </script>
    	</head>
    
    	<body leftmargin="2" topmargin="2" >
    <table width='98%'  border='0' align="center">
             <tr>
        <td ><form action="<%=path %>/wenjuan?type=wenjuanMana" name="formAdd" method="post">
             
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="text" name="name" size="20" value="<%if(request.getParameter("name")!=null){out.print(request.getParameter("name"));} %>"/>
            <input  type="submit" value="搜索"    />
          </form></td>
      </tr>
           </table>
    			<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
    				<tr bgcolor="#E7E7E7">
    					<td height="14" colspan="7" background="<%=path %>/images/wbg.gif">问卷管理</td>
    				</tr>
    				<tr align="center" bgcolor="#FAFAF1" height="22">
    					<td>名称</td>
    					<td>内容</td>
    					<td>类型</td>
    					<td>发布人</td>
    					<td>发布时间</td>
    					<td>问卷明细</td>
    					<td>操作</td>
    		        </tr>	
    				<c:forEach items="${requestScope.wenjuanList}" var="wenjuan">
    				<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
    					<td bgcolor="#FFFFFF" align="center">
    						 ${wenjuan.title}
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    					    <a href="#" onclick="wenjuanDetail(${wenjuan.id})" class="pn-loperator">查看内容</a>
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    						 ${wenjuan.type_name}
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    						 ${wenjuan.user_name}
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    						 ${wenjuan.shijian}
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    						<a href="#" style="color: red" onclick="timuByWenjuan(${wenjuan.id})" class="pn-loperator">查看问卷题目</a>
    						
    						<a href="#" style="color: red" onclick="timuAll(${wenjuan.user_id},${wenjuan.id})" class="pn-loperator">题目添加</a>
                          
    					</td>
    					<td bgcolor="#FFFFFF" align="center">
    						<a class="pn-loperator" href="<%=path %>/wenjuan?type=wenjuanDel&id=${wenjuan.id}">删除</a>
    					</td>
    				</tr>
    				</c:forEach>
    			</table>
                <table width='98%'  border='0'style="margin-top:8px;margin-left: 5px;">
    			 <TR align="right">
                  <TD ><form action="" method="post" name="formpage">
                      <input type="hidden" name="pageCount" value="${requestScope.pagecount}" />
                      <!--//用于给上面javascript传值-->
                      <input type="hidden" name="page" value="${requestScope.page}" />
                      <!--//用于给上面javascript传值-->
                      <input type="hidden" name="jumpurl" value="<%=path%>/wenjuan?type=wenjuanMana&" />
                      <!--//用于给上面javascript传值--> 
                      <a href="#" onClick="PageTop()"><strong>首页</strong></a>&nbsp;&nbsp;&nbsp; 
                      <a href="#" onClick='PagePre()'><strong>上一页</strong></a>&nbsp;&nbsp;&nbsp;
                      共${requestScope.cou}条记录,
                      共计${requestScope.pagecount}页,
                      当前第${requestScope.page}页&nbsp;&nbsp;&nbsp; 
                      <a href="#" onClick="PageNext()"><strong>下一页</strong></a>&nbsp;&nbsp;&nbsp; 
                      <a href="#" onClick="PageLast()"><strong>尾页</strong></a> 第
                      <input name="busjump" type="text" size="3" value="${requestScope.page}" style=" width:15px"/>
                      页<a href="#" onClick="bjump()"><strong>跳转</strong></a>&nbsp;&nbsp;&nbsp;
                    </form>
                    <script type="text/javascript" src="<%=path%>/js/page.js"></script></TD>
                </TR>
    		    </table>
    			
    			
    	</body>
    </html>
    

    更多相关内容
  • 基于JavaWeb的简易投票系统

    千次阅读 2021-06-19 16:17:30
    基于JavaWeb的简易投票系统 1.工具 IDEA JDK1.8 Tomcat8.5 MySQL 2.MySQL数据库 subjects表 /* Navicat Premium Data Transfer Source Server : zxy Source Server Type : MySQL Source Server Version : ...

    基于JavaWeb的简易投票系统

    项目文件
    数据库文件

    1.工具

    IDEA
    JDK1.8
    Tomcat8.5
    MySQL

    2.MySQL数据库

    • subjects表

    在这里插入图片描述

    /*
     Navicat Premium Data Transfer
    
     Source Server         : zxy
     Source Server Type    : MySQL
     Source Server Version : 50710
     Source Host           : localhost:3306
     Source Schema         : java_test
    
     Target Server Type    : MySQL
     Target Server Version : 50710
     File Encoding         : 65001
    
     Date: 19/06/2021 16:16:30
    */
    
    SET NAMES utf8mb4;
    SET FOREIGN_KEY_CHECKS = 0;
    
    -- ----------------------------
    -- Table structure for subjects
    -- ----------------------------
    DROP TABLE IF EXISTS `subjects`;
    CREATE TABLE `subjects`  (
      `id` int(10) NOT NULL COMMENT '主题ID',
      `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主题名',
      `totalVotes` int(50) NOT NULL COMMENT '投票人数',
      `viewTimes` int(50) NOT NULL COMMENT '查看次数',
      `createDate` date NOT NULL COMMENT '创建时间',
      PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of subjects
    -- ----------------------------
    INSERT INTO `subjects` VALUES (1, '本次考试难度如何', 30, 100, '2021-06-18');
    INSERT INTO `subjects` VALUES (2, '导致空气污染得主要原因是什么', 40, 200, '2021-06-18');
    INSERT INTO `subjects` VALUES (3, '你幸福吗', 35, 150, '2021-06-18');
    
    SET FOREIGN_KEY_CHECKS = 1;
    
    
    • options表

    在这里插入图片描述

    /*
     Navicat Premium Data Transfer
    
     Source Server         : zxy
     Source Server Type    : MySQL
     Source Server Version : 50710
     Source Host           : localhost:3306
     Source Schema         : java_test
    
     Target Server Type    : MySQL
     Target Server Version : 50710
     File Encoding         : 65001
    
     Date: 19/06/2021 16:16:38
    */
    
    SET NAMES utf8mb4;
    SET FOREIGN_KEY_CHECKS = 0;
    
    -- ----------------------------
    -- Table structure for options
    -- ----------------------------
    DROP TABLE IF EXISTS `options`;
    CREATE TABLE `options`  (
      `id` int(10) NOT NULL COMMENT '选项ID',
      `optContent` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '选项内容',
      `vote` int(50) NOT NULL COMMENT '得票数',
      `sid` int(50) NOT NULL COMMENT '主题ID,主题表外键',
      PRIMARY KEY (`id`) USING BTREE,
      INDEX `sid`(`sid`) USING BTREE,
      CONSTRAINT `sid` FOREIGN KEY (`sid`) REFERENCES `subjects` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
    ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of options
    -- ----------------------------
    INSERT INTO `options` VALUES (1, '很难', 5, 1);
    INSERT INTO `options` VALUES (2, '比较难', 10, 1);
    INSERT INTO `options` VALUES (3, '一般', 5, 1);
    INSERT INTO `options` VALUES (4, '容易', 3, 1);
    INSERT INTO `options` VALUES (5, '很容易', 7, 1);
    
    SET FOREIGN_KEY_CHECKS = 1;
    
    

    3.准备工作

    • tomcat
      在这里插入图片描述在这里插入图片描述

    • mybatis-3-cfg.xml
      在这里插入图片描述

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE configuration
            PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-config.dtd">
    <configuration>
        <environments default="development">
            <environment id="development">
                <transactionManager type="JDBC"/>
                <dataSource type="POOLED">
                    <property name="driver" value="com.mysql.jdbc.Driver"/>
                    <property name="url" value="jdbc:mysql://localhost:3306/java_test?useUnicode=true&amp;characterEncoding=utf8"/>
                    <property name="username" value="root"/>
                    <property name="password" value="root"/>
                </dataSource>
            </environment>
        </environments>
        <!-- 让主配置文件引用映射配置文件 -->
        <mappers>
            <mapper resource="com/zxy/mapper/UserMapper.xml"/>
        </mappers>
    </configuration>
    
    • lib

    Project Structure --》Modoules --》 Dependencies --》点击“+”添加JARS,选中lib目录就可以
    在这里插入图片描述

    JSP页面

    • index.jsp
      在这里插入图片描述
    <%@ page import="com.zxy.pojo.Subjects" %>
    <%@ page import="java.util.List" %>
    <%--
      Created by IntelliJ IDEA.
      User: ZXY
      To change this template use File | Settings | File Templates.
    --%>
    
    
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>主题页面</title>
    </head>
    <body>
    <a href="SubjectServlet">投票系统</a>
    </body>
    </html>
    
    
    • show.jsp
      在这里插入图片描述
    <%@ page import="com.zxy.pojo.Subjects" %>
    <%@ page import="java.util.List" %>
    <%--
      Created by IntelliJ IDEA.
      User: ZXY
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>主题页面</title>
    </head>
    <body>
    <a href="/SubjectServlet">全部主题 >></a>
    <%--  <div style="text-align: center">全部主题 >></div>--%>
    
    <form action="/OptionServlet" method="post">
        <table border="1">
            <tr>
                <th>序号</th>
                <th>主题</th>
                <th>投票/查看</th>
                <th>创建时间</th>
            </tr>
            <%
                List<Subjects> subjects = (List<Subjects>) session.getAttribute("subjects");
                for(Subjects lists:subjects){
            %>
            <tr>
                <td><%=lists.getId()%></td>
                <td>
                    <input type="submit" value="<%=lists.getTitle()%>">
                </td>
                <td><%=lists.getTotalVotes()%>/<%=lists.getViewTimes()%></td>
                <td><%=lists.getCreateDate()%></td>
            </tr>
            <%
                }
            %>
        </table>
    </form>
    </body>
    </html>
    
    
    
    • Option.jsp
      在这里插入图片描述在这里插入图片描述
    <%@ page import="com.zxy.pojo.Options" %>
    <%@ page import="java.util.List" %>
    <%@ page import="com.zxy.pojo.Subjects" %><%--
      Created by IntelliJ IDEA.
      User: ZXY
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>投票选项</title>
    </head>
    <body>
    <h2>本次投票难度如何</h2>
    <%
        List<Subjects> subjects = (List<Subjects>) session.getAttribute("subject");
        for(Subjects list:subjects){
            if(list.getId() == 1){
    %>
    <h3><%=list.getViewTimes()%>次查看,共有<%=list.getTotalVotes()%>人投票</h3>
    <%
            }
        }
    %>
    <form action="/UpdateVoteServlet" method="post" id="updateVotes">
    
        <table border="1">
            <tr>
                <th>序号</th>
                <th>选项</th>
                <th>票数</th>
                <th>投票率</th>
            </tr>
            <%
                List<Options> Options = (List<Options>) session.getAttribute("option");
                subjects = (List<Subjects>) session.getAttribute("subject");
                for(Subjects sub : subjects){
                    if(sub.getId() == 1){
                        int sumVote = sub.getTotalVotes();
                        System.out.println("sumvote");
                        System.out.println(sumVote);
                        for(Options lists:Options){
                        double sum = ((double)lists.getVote()/(double)sumVote) * 100;
                            long round = Math.round(sum * 100);
                            double s = round / 100.0;
                            System.out.println("lists.getvote()");
                            System.out.println(lists.getVote());
                            System.out.println("s");
                            System.out.println(s);
            %>
            <tr>
                <td><%=lists.getId()%></td>
                <td><%=lists.getOptContent()%></td>
                <td><%=lists.getVote()%></td>
                <td><%=s%>%</td>
            </tr>
            <%
                           }
                        }
                    }
            %>
        </table>
        投票选项<input type="text" name="id" id="id"><br>
        <span id="msg" style="font-size: 12px;color: red">${messageModel.msg}</span> <br>
        <button type="button" id="loginBtn" >投票</button>
    </form>
    
    
    </body>
    
    <script type="text/javascript" src="js/jquery-3.4.1.js"></script>
    <script type="text/javascript">
    
        $("#loginBtn").click(function () {
            var id = $("#id").val();
    
            if(isEmpty(id)){
                $("#msg").html("投票选项不能为空!");
                return;
            }
    
            $("#updateVotes").submit()
        });
    
        /**
         * 判断用户名或者密码为空的函数
         */
        function isEmpty(str) {
            if(str == null || str.trim() == ""){
                return true;
            }
            return false;
        }
    </script>
    </html>
    
    </html>
    
    
    • Votes.jsp

    在这里插入图片描述

    <%@ page import="com.zxy.pojo.Options" %>
    <%@ page import="java.util.List" %>
    <%@ page import="com.zxy.pojo.Subjects" %><%--
      Created by IntelliJ IDEA.
      User: ZXY
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>投票选项</title>
    </head>
    <body>
    
    <form action="/UpdateVoteServlet" method="post">
    
        <table border="1">
            <tr>
                <th>序号</th>
                <th>选项</th>
                <th>票数</th>
                <th>投票率</th>
            </tr>
            <%
                List<Options> Options = (List<Options>) session.getAttribute("option");
                List<Subjects> subjects = (List<Subjects>) session.getAttribute("subject");
                for(Subjects sub : subjects){
                    if(sub.getId() == 1){
                        int sumVote = sub.getTotalVotes();
                        System.out.println("sumvote");
                        System.out.println(sumVote);
                        for(Options lists:Options){
                        double sum = ((double)lists.getVote()/(double)sumVote) * 100;
                            long round = Math.round(sum * 100);
                            double s = round / 100.0;
                            System.out.println("lists.getvote()");
                            System.out.println(lists.getVote());
                            System.out.println("s");
                            System.out.println(s);
            %>
            <tr>
                <td><%=lists.getId()%></td>
                <td><%=lists.getOptContent()%></td>
                <td><%=lists.getVote()%></td>
                <td><%=s%>%</td>
            </tr>
            <%
                           }
                        }
                    }
            %>
        </table>
    </form>
    <a href="/show.jsp"><input type="button" value="返回主题页面"></a>
    </body>
    </html>
    
    
    • web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
             version="4.0">
        <servlet>
            <servlet-name>SubjectServlet</servlet-name>
            <servlet-class>com.zxy.controller.SubjectServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>SubjectServlet</servlet-name>
            <url-pattern>/SubjectServlet</url-pattern><!-- 访问servlet的路径 -->
        </servlet-mapping>
    
        <servlet>
            <servlet-name>OptionServlet</servlet-name>
            <servlet-class>com.zxy.controller.OptionServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>OptionServlet</servlet-name>
            <url-pattern>/OptionServlet</url-pattern><!-- 访问servlet的路径 -->
        </servlet-mapping>
    
        <servlet>
            <servlet-name>UpdateVoteServlet</servlet-name>
            <servlet-class>com.zxy.controller.UpdateVoteServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>UpdateVoteServlet</servlet-name>
            <url-pattern>/UpdateVoteServlet</url-pattern><!-- 访问servlet的路径 -->
        </servlet-mapping>
    </web-app>
    

    JavaWeb

    mapper

    • UserMapper.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE mapper
            PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <!--
        从现在开始不能随便
        namespace : mapper配置文件对应的mapper接口的包名.类名
        id : mapper接口中对应的方法名称
    -->
    <mapper namespace="com.zxy.mapper.UserMapper">
        <!-- 映射配置文件用于专门写sql,查询所有的员工信息 -->
        <select id="queryUserByName" parameterType="String" resultType="com.zxy.pojo.User">
            select * from tb_user where userName = #{uname}
        </select>
    
        <select id="queryAllSubject" resultType="com.zxy.pojo.Subjects">
            SELECT * FROM `subjects`
        </select>
        <select id="queryAllOption" resultType="com.zxy.pojo.Options">
            SELECT * FROM `options`
        </select>
        
        <select id="updateOptionVote" resultType="com.zxy.pojo.Options">
            update `options` set vote=vote+1 where id = #{id}
        </select>
    
    </mapper>
    
    • UserMapper.java
    package com.zxy.mapper;
    
    
    import com.zxy.pojo.Options;
    import com.zxy.pojo.Subjects;
    import com.zxy.pojo.User;
    
    import java.util.List;
    
    public interface UserMapper {
        /**
         * UserMapper.xml
         * <select id="queryUserByName" parameterType="String" resultType="com.zxy.entity.User">
         * User,queryUserByName,String
         * 类型,名称,返回值类型
         * @param uname
         * @return
         */
        public User queryUserByName(String uname);
    
        /**
         *     <select id="queryAllSubject" resultType="com.zxy.pojo.Subjects">
         *         SELECT * FROM `subjects`
         *     </select>
         */
        List<Subjects> queryAllSubject();
        List<Options> queryAllOption();
        List<Options> updateOptionVote(String id);
    }
    
    

    service

    • SubjectServiceImpl
    package com.zxy.service.impl;
    
    import com.zxy.mapper.UserMapper;
    import com.zxy.pojo.Options;
    import com.zxy.pojo.Subjects;
    import com.zxy.service.SubjectService;
    import com.zxy.util.MybatisUtils;
    import org.apache.ibatis.session.SqlSession;
    
    import java.util.List;
    
    public class SubjectServiceImpl implements SubjectService {
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        private UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
    
        public List<Subjects> findAllSubject() {
            return userMapper.queryAllSubject();
        }
        public List<Options> findAllOption() {
            return userMapper.queryAllOption();
        }
        public List<Options> updateOptionVote(String id) {
            return userMapper.updateOptionVote(id);
        }
    }
    
    
    • subjectService.java
    package com.zxy.service;
    
    import com.zxy.pojo.Options;
    import com.zxy.pojo.Subjects;
    
    import java.util.List;
    
    public interface SubjectService {
        List<Subjects>  findAllSubject();
        List<Options> findAllOption();
        List<Options> updateOptionVote(String id);
    }
    
    

    controller

    • SubjectServlet.java
    package com.zxy.controller;
    
    import com.zxy.pojo.Subjects;
    import com.zxy.service.SubjectService;
    import com.zxy.service.impl.SubjectServiceImpl;
    
    import javax.jws.WebService;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.List;
    /**
     * 主题类的Servlet,读取数据库中数据,并返回给index.jsp
     */
    public class SubjectServlet extends HttpServlet {
        private SubjectService subjectService = new SubjectServiceImpl();
    
        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            List<Subjects> subjects = subjectService.findAllSubject();
            for (Subjects s:subjects) {
                System.out.println(s.getTitle());
            }
    
            if(subjects != null) {
                req.getSession().setAttribute("subjects", subjects);
                resp.sendRedirect("show.jsp");
            }else{
                req.getRequestDispatcher("/login.jsp").forward(req,resp);
            }
        }
    
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            List<Subjects> subjects = subjectService.findAllSubject();
            for (Subjects s:subjects) {
                System.out.println(s.getTitle());
            }
    
            if(subjects != null) {
                request.getSession().setAttribute("subjects", subjects);
                response.sendRedirect("show.jsp");
            }else{
                request.getRequestDispatcher("/login.jsp").forward(request,response);
            }
    
        }
    
    }
    
    
    • Optionservlet.java
    package com.zxy.controller;
    
    import com.zxy.pojo.Options;
    import com.zxy.pojo.Subjects;
    import com.zxy.service.SubjectService;
    import com.zxy.service.impl.SubjectServiceImpl;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.List;
    
    
    public class OptionServlet extends HttpServlet {
    
        private SubjectService subjectService = new SubjectServiceImpl();
    
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            List<Options> option = subjectService.findAllOption();
            List<Subjects> subject = subjectService.findAllSubject();
            for(Options op:option){
                System.out.println(op.getId());
            }
            request.getSession().setAttribute("subject", subject);
            request.getSession().setAttribute("option", option);
            response.sendRedirect("Option.jsp");
        }
    }
    
    
    • UpdateVoteServlet.java
    package com.zxy.controller;
    
    import com.zxy.pojo.Options;
    import com.zxy.pojo.Subjects;
    import com.zxy.service.SubjectService;
    import com.zxy.service.impl.SubjectServiceImpl;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.util.List;
    
    public class UpdateVoteServlet extends HttpServlet {
        private SubjectService subjectService = new SubjectServiceImpl();
        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    
        }
    
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String id = request.getParameter("id");
            List<Options> options = subjectService.updateOptionVote(id);
            List<Subjects> subject = subjectService.findAllSubject();
            List<Options> option = subjectService.findAllOption();
            request.getSession().setAttribute("option", option);
            request.getSession().setAttribute("subject", subject);
                response.sendRedirect("Votes.jsp");
        }
    }
    
    

    pojo

    • Subjects.java
    package com.zxy.pojo;
    
    import java.util.Date;
    
    public class Subjects {
        private Integer id;
        private String title;
        private Integer totalVotes;
        private Integer viewTimes;
        private Date createDate;
    
        public Subjects() {
        }
    
        public Subjects(Integer id, String title, Integer totalVotes, Integer viewTimes, Date createDate) {
            this.id = id;
            this.title = title;
            this.totalVotes = totalVotes;
            this.viewTimes = viewTimes;
            this.createDate = createDate;
        }
    
        public Integer getId() {
            return id;
        }
    
        public void setId(Integer id) {
            this.id = id;
        }
    
        public String getTitle() {
            return title;
        }
    
        public void setTitle(String title) {
            this.title = title;
        }
    
        public Integer getTotalVotes() {
            return totalVotes;
        }
    
        public void setTotalVotes(Integer totalVotes) {
            this.totalVotes = totalVotes;
        }
    
        public Integer getViewTimes() {
            return viewTimes;
        }
    
        public void setViewTimes(Integer viewTimes) {
            this.viewTimes = viewTimes;
        }
    
        public Date getCreateDate() {
            return createDate;
        }
    
        public void setCreateDate(Date createDate) {
            this.createDate = createDate;
        }
    
        @Override
        public String toString() {
            return "Subjects{" +
                    "id=" + id +
                    ", title='" + title + '\'' +
                    ", totalVotes=" + totalVotes +
                    ", viewTimes=" + viewTimes +
                    ", createDate=" + createDate +
                    '}';
        }
    }
    
    
    • Options.java
    package com.zxy.pojo;
    
    public class Options {
        private Integer id;
        private String optContent;
        private Integer vote;
        private Integer sid;
    
        public Integer getId() {
            return id;
        }
    
        public void setId(Integer id) {
            this.id = id;
        }
    
        public String getOptContent() {
            return optContent;
        }
    
        public void setOptContent(String optContent) {
            this.optContent = optContent;
        }
    
        public Integer getVote() {
            return vote;
        }
    
        public void setVote(Integer vote) {
            this.vote = vote;
        }
    
        public Integer getSid() {
            return sid;
        }
    
        public void setSid(Integer sid) {
            this.sid = sid;
        }
    }
    
    

    utils

    • MybatisUtils.java
    package com.zxy.util;
    
    import org.apache.ibatis.session.SqlSession;
    import org.apache.ibatis.session.SqlSessionFactory;
    import org.apache.ibatis.session.SqlSessionFactoryBuilder;
    
    public class MybatisUtils {
        private static final String DEFAULT_CONFIG_XML = "mybatis-3-cfg.xml";
        private static SqlSessionFactory sqlSessionFactory;
        static {
            sqlSessionFactory
                    = new SqlSessionFactoryBuilder().build(MybatisUtils.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_XML));
        }
    
        public static SqlSession getSqlSession() {
            return sqlSessionFactory.openSession();
        }
    
        public static void close(SqlSession sqlSession) {
            if (sqlSession != null) sqlSession.close();
        }
    
    }
    
    

    在这里插入图片描述

    展开全文
  • javaweb中怎么用application制作投票系统,不使用数据库,结果用图片显示投票结果
  • 在线投票系统 jsp+tomcat

    热门讨论 2011-03-11 10:44:20
    第3部分 系统设计 3 3.1.功能模块设计 3 3.2.数据库的设计 3 第4部分 系统开发 3 4.1.数据库 3 4.1.1.创建数据库 3 4.1.2.创建表 4 4.1.3.连接数据库 4 4.2.功能的实现 5 4.3.问题及解决 5 第5...
  • (1)制作一个投票系统,让学生给自己喜爱的老师投票。该系统由投票界面组成,系统运行,投票界面出现,标题为“欢迎给老师投票”;在界面上有一个表格,显示了各位老师的编号、姓名、得票数;其中,得票数显示为一...

    需求分析

    (1)制作一个投票系统,让学生给自己喜爱的老师投票。该系统由投票界面组成,系统运行,投票界面出现,标题为“欢迎给老师投票”;在界面上有一个表格,显示了各位老师的编号、姓名、得票数;其中,得票数显示为一个红色的进度条,并显示得票的数值;表格的第四列是投票链接,单击链接,该教师的票数加1,并显示在界面上。
    (2)实现上述功能后,可考虑进一步改进。如对数据库的封装以及重用代码等;
    (3)进一步思考,考虑系统是否存在刷票的隐患,如何防止刷票。

    项目源码:

    https://download.csdn.net/download/qq_43299503/12037158

    实验结果

    投票界面:
    在这里插入图片描述
    第一次点击提交投票,界面会自动刷新票数:
    在这里插入图片描述
    第二次点击提交投票:投票失败界面——用于防止刷票(一个小时内只能投一票)
    在这里插入图片描述

    对数据库的封装以及重用代码

    package db;
    
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.Statement;
    
    import dao.User;
    import dao.Vote;
    
    public class DB {
    
    	private String className;
    	private String url;
    	private String username;
    	private String password;
    	private Connection con;
    	private Statement st;
    	private ResultSet res;
    	public DB() {
    		className="com.mysql.jdbc.Driver";
    		url="jdbc:mysql://localhost:3306/votedb";
    		username = "root";
    		password = "";
    	}
    	public void loadDriver() {
    		try {
    			Class.forName(className);
    		} catch (ClassNotFoundException e) {
    			// TODO Auto-generated catch block
    			System.out.println("加载数据库驱动失败!");
    			e.printStackTrace();
    		}
    	}
    	public void getConnection() {
    		loadDriver();
    		try {
    			con = (Connection) DriverManager.getConnection(url, username, password);
    		} catch (SQLException e) {
    			// TODO Auto-generated catch block
    			System.out.println("连接数据库失败!");
    			e.printStackTrace();
    		}
    	}
    	public void getStatement() {
    		getConnection();
    		try {
    			st = (Statement) con.createStatement();
    		} catch (SQLException e) {
    			// TODO Auto-generated catch block
    			System.out.println("获取statement对象失败");
    			e.printStackTrace();
    		}
    	}
    	public void getResultSet(String sql) {
    		if(sql != null && !sql.equals("")) {
    			getStatement();
    			try {
    				res = st.executeQuery(sql);
    			} catch (SQLException e) {
    				// TODO Auto-generated catch block
    				System.out.println("查询数据库失败!");
    				e.printStackTrace();
    			}
    		}
    	}
    	public void closed() {
    		try {
    			if(res != null) {
    				res.close();
    			}
    			if(con != null) {
    				con.close();
    			}
    			if(st != null) {
    				st.close();
    			}
    		} catch (SQLException e) {
    			// TODO Auto-generated catch block
    			System.out.println("关闭数据库失败!");
    			e.printStackTrace();
    		}
    	}
    	
    	
    	public ArrayList<Vote> getAllVotes() throws SQLException{
    		String sql = "select * from vote";
    		getResultSet(sql);
    		ArrayList<Vote> al = new ArrayList<Vote>();
    		
    		while(res.next()) {
    			Vote vote = new Vote();
    			vote.setTeacherid(res.getString("teacherid"));
    			vote.setTeachername(res.getString("teachername"));
    			vote.setVotenumber(res.getInt("votenumber"));
    			al.add(vote);
    		}
    		res.close();
    		 
    		return al;
    	}
    	
    	public void updateVotes(String [] teacherid) throws SQLException {
    		getConnection();
    		String sql = "update vote set votenumber = votenumber+1 where teacherid = ?";
    		PreparedStatement ps = con.prepareStatement(sql);
    		
    		for(int i=0;i<teacherid.length;i++) {
    			ps.setString(1, teacherid[i]);
    			ps.executeUpdate();
    		}
    		closed();
    	}
    	
    	public void updateUsers(String ip,long today) throws SQLException {
    		getConnection();
    		String sql = "update users set lastTime ="+ today +" where ip= '"+ip+ "'";
    		PreparedStatement ps = con.prepareStatement(sql);
    		ps.executeUpdate();
    		closed();
    	}
    	
    	public void insertUsers(String ip,long today) throws SQLException {
    		getConnection();
    		String sql = "insert into users(ip, lastTime) values('"+ip+"','+"+today+"')";
    		PreparedStatement ps = con.prepareStatement(sql);
    		ps.executeUpdate();
    		closed();
    	}
    	
    	public User findUser(String ip) {
    		User u = null;
    		String sql = "select * from users where ip = '" + ip + "'";
    		getResultSet(sql);
    		if(res != null) {
    			try {
    				while(res.next()) {
    					u = new User();
    					u.setId(res.getString("id"));
    					u.setIp(res.getString("ip"));
    					u.setLastTime(res.getLong("lastTime"));
    				}
    			} catch (SQLException e) {
    				// TODO Auto-generated catch block
    				System.out.println("封装vote表中数据失败!finduser函数");
    				e.printStackTrace();
    			}finally {
    				closed();
    			}
    		}
    		return u;
    	}
    	
    	public Vote findvote(int id) {
    		Vote v = new Vote();
    		String sql = "select * from vote where teacherid = " + id;
    		getResultSet(sql);
    		if(res == null) {
    			v = null;
    			return v;
    		}else {
    			try {
    				while(res.next()) {
    					v.setTeacherid(res.getString("teacherid"));
    					v.setTeachername(res.getString("teachername"));
    					v.setVotenumber(res.getInt("votenumber"));
    				}
    			} catch (SQLException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    			return v;
    		}
    	}
    }
    
    

    防止刷票功能的实现

    vode.jsp

    <%
    	String [] teacherid = request.getParameterValues("teacherid");
    	DB db = new DB();
    	
    	//防止刷票
    	long cc = 0, dd = 0;
    	int id = MyTool.strToInt(request.getParameter("like"));
    	Date date = new Date();
    	Vote v = db.findvote(id);
    	long today = date.getTime();
    	long lastTime = 0;
    	String ip= "005";
    	User u = db.findUser(ip);
    	String sql = "";
    	int i=-1,flag=-1;
    	if(u == null){
    		u = new User();
    		u.setIp(ip);
    		u.setLastTime(today);
    		flag=0;
    		
    	}else{
    		lastTime = u.getLastTime();
    		cc = today;
    		dd = lastTime;
    		if((today - lastTime) >= 60 * 60 * 1000){
    			flag=1;
    		}else{
    			flag=2;
    			
    		}
    	}
    	
    	if(flag == 0){
    		db.insertUsers(ip, today);
    		if(i < 0){
    			System.out.println("插入user失败!");
    			i = -1;
    		}
    		db.updateVotes(teacherid);
    		if(i < 0){
    			System.out.println("更新vote表失败(num+1)");
    			i = -1;
    		}
    		response.sendRedirect("index.jsp");
    	}
    	if(flag == 1){
    		db.updateVotes(teacherid);
    		if(i < 0){
    			System.out.println("更新vote表失败(num+1)");
    			i = -1;
    		}
    		db.updateUsers(ip, today);
    		if(i < 0){
    			System.out.println("更新user表失败lastTime=today");
    			i = -1;
    		}
    		response.sendRedirect("index.jsp");
    	}
    	if(flag == 2){
    		//response.sendRedirect("index.jsp");
    		//db.updateVotes(teacherid);
    		response.sendRedirect("message.jsp");
    	}
    	
    %>
    

    防止刷票的工具类:

    package tool;
    
    
    import java.io.UnsupportedEncodingException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    public class MyTool {
    	public static String toChinese(String str) {
    		if(str == null) {
    			str="";
    		}
    		try {
    			str = new String(str.getBytes("ISO-8859-1"),"gb2312");
    		}catch(UnsupportedEncodingException e) {
    			str="";
    			e.printStackTrace();
    		}
    		return str;
    	}
    	public static int strToInt(String str) {
    		if(str == null || str.equals("")) {
    			str = "0";
    		}
    		int i = 0;
    		try {
    			i = Integer.parseInt(str);
    		}catch(NumberFormatException e) {
    			i = 0;
    			e.printStackTrace();
    		}
    		return i;
    	}
    	public static String formatDate(long ms){
    		Date date=new Date(ms);
    		SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    		String strDate=format.format(date);
    		return strDate;
    	}
    }
    
    
    

    项目详细设计

    项目结构
    在这里插入图片描述

    数据库设计

    Users:
    在这里插入图片描述
    vote:
    在这里插入图片描述

    展开全文
  • javaweb中如和做一个简单的投票系统,比如张三和李四两个人,利用单选按钮给他们投票,并且能够统计两人分别的票数。 用两个jsp来实现,一个是提交页面,一个是统计页面。还请各位前辈指教,谢谢。
  • 实训:在线投票系统

    万次阅读 多人点赞 2021-06-28 09:14:04
    JSP实训--------在线投票系统 前言 给自己: 内容: 功能模块划分 用户(管理员)登录 投票系统主页面 参与投票 查询投票结果 注意事项 问题及其解决方案 主要实现: 一、 功能模块划分图 二、 数据库表设计 1....

    JSP实训--------在线投票系统

    注:!!!!! 项目源码https://github.com/Hardman233/MyLearnProject.git 需要可自取仅用于学习

    前言

    给自己:
    

    内容:

    • 功能模块划分
    • 用户(管理员)登录
    • 投票系统主页面
    • 参与投票
    • 查询投票结果
    • 注意事项
    • 问题及其解决方案

    主要实现:

    一、 功能模块划分图与类图
    在这里插入图片描述
    在这里插入图片描述

    二、 数据库表设计
    1.设计user表在这里插入图片描述
    2.设计vote表
    在这里插入图片描述

    3.设计beforevote表

    在这里插入图片描述

    三、 创建JavaWeb项目
    在这里插入图片描述
    四、 部署Tomcat及其其他配置问题
    在这里插入图片描述

    在这里插入图片描述
    注:
    1.尽量用debug模式启动tomcat,用run启动的话仅JSP和其他静态资源有效,如果是debug启动则java+jsp等均有效
    2.Frame:updata classes and resources

    五、 设计封装数据与业务逻辑(分三层)的JavaBean
    1.设计user

    package Bean;
    
    public class user {
        private int id;
        private String u_name;
        private String u_pwd;
    
        public user(int id, String u_name, String u_pwd) {
            this.id = id;
            this.u_name = u_name;
            this.u_pwd = u_pwd;
        }
    
        public int getId() {
            return id;
        }
    
        public void setId(int id) {
            this.id = id;
        }
    
        public String getU_name() {
            return u_name;
        }
    
        public void setU_name(String u_name) {
            this.u_name = u_name;
        }
    
        public String getU_pwd() {
            return u_pwd;
        }
    
        public void setU_pwd(String u_pwd) {
            this.u_pwd = u_pwd;
        }
    }
    
    

    2.设计vote

    
    public class vote {
        private int id;
        private String v_title;
        private int v_number;
    
        public vote(int id, String v_title, int v_number) {
            this.id = id;
            this.v_title = v_title;
            this.v_number = v_number;
        }
    
        public int getId() {
            return id;
        }
    
        public void setId(int id) {
            this.id = id;
        }
    
        public String getV_title() {
            return v_title;
        }
    
        public void setV_title(String v_title) {
            this.v_title = v_title;
        }
    
        public int getV_number() {
            return v_number;
        }
    
        public void setV_number(int v_number) {
            this.v_number = v_number;
        }
    }
    
    

    3.设计beforevote

    package Bean;
    
    public class beforevote {
        private int id;
        private String bv_name;
    
        public beforevote(int id, String bv_name) {
            this.id = id;
            this.bv_name = bv_name;
        }
    
        public int getId() {
            return id;
        }
    
        public void setId(int id) {
            this.id = id;
        }
    
        public String getBv_name() {
            return bv_name;
        }
    
        public void setBv_name(String bv_name) {
            this.bv_name = bv_name;
        }
    }
    

    4.设计DAO层(user+vote)

    package Bean;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    
    public class userDao {
    
        //增
        public boolean addUser(user user) {
            String sql = "insert into user (id,u_name,u_pwd) values(?,?,?)";
            Object[] params = {user.getId(),user.getU_name(),user.getU_pwd()};
            return DBUtil.excuteUpdate(sql,params);
        }
    
        //通过用户名查找
        public user queryUserByName(String u_name) {
            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            user user = null;
            try {
                String sql = "select * from user where u_name = ?";
                Object[] params = {u_name};
                //预编译
                rs = DBUtil.executeQuery(sql,params);
                if (rs.next()){
                    int dId = rs.getInt("id");
                    String uname = rs.getString("u_name");
                    String pwd = rs.getString("u_pwd");
                    user users = new user(dId,uname,pwd);
                }
                return user;
    
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return null;
            } catch (Exception e){
                e.printStackTrace();
                return null;
            } finally {
                //关
                DBUtil.closeAll(rs,pstmt,DBUtil.con);
            }
        }
    
        //通过id查找
        public user queryUserById(int id) {
            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            user user = null;
            try {
                String sql = "select * from user where id = ?";
                Object[] params = {user.getId()};
                //预编译
                rs = DBUtil.executeQuery(sql,params);
                if (rs.next()){
                    int dId = rs.getInt("id");
                    String uname = rs.getString("u_name");
                    String pwd = rs.getString("u_pwd");
                    user = new user(dId,uname,pwd);
                }
                return user;
    
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return null;
            } catch (Exception e){
                e.printStackTrace();
                return null;
            } finally {
                //关
                DBUtil.closeAll(rs,pstmt,DBUtil.con);
            }
        }
    
        //通过id判断是否存在
        public boolean isQueryExistById(int id) {
            return queryUserById(id)==null?false:true;
        }
    
        //通过用户名判断是否存在
        public boolean isQueryExistByName(String u_name) {
            return queryUserByName(u_name)==null?false:true;
        }
    
        //登录验证
        public boolean loginUserQuery(String name, String pwd){
            String sql = "select * from user where u_name =? and u_pwd =?";
            Object[] params = {name,pwd};
            return DBUtil.loginQuery(sql,params);
        }
    
    }
    
    
    package Bean;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    
    public class voteDao {
    
        //增加投票项目(管理员用)
        public boolean addVoteTitle(vote vote) {
            String sql = "insert into vote (id,v_title,v_number) values(?,?,?)";
            Object[] params = {vote.getId(),vote.getV_title(),vote.getV_number()};
            return DBUtil.excuteUpdate(sql,params);
        }
    
        //增加投票票数(用户使用)
        public boolean updateUserById(int id) {
            String sql = "update vote set v_number = (v_number+1) where id = ?";
            Object[] params = {id};
            return DBUtil.excuteUpdate(sql,params);
        }
    
    
        //通过id查找
        public vote queryVoteTitleById(int id) {
            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            vote vote = null;
            try {
                String sql = "select * from vote where id = ?";
                Object[] params = {id};
                //预编译
                rs = DBUtil.executeQuery(sql,params);
                if (rs.next()){
                    int dId = rs.getInt("id");
                    String v_title = rs.getString("v_title");
                    int v_number = rs.getInt("v_number");
                    vote = new vote(dId,v_title,v_number);
                }
                return vote;
    
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return null;
            } catch (Exception e){
                e.printStackTrace();
                return null;
            } finally {
                //关
                DBUtil.closeAll(rs,pstmt,DBUtil.con);
            }
        }
    
        //通过id判断是否存在
        public boolean isQueryExistById(int id) {
            return queryVoteTitleById(id)==null?false:true;
        }
    
        //查询所有项目选项
        public List<vote> queryAllVote() {
            PreparedStatement pstmt = null;
            vote vote = null;
            List<vote> votes = new ArrayList<>();
            ResultSet rs = null;
            try {
                String sql = "select * from vote";
                rs = DBUtil.executeQuery(sql,null);
                while (rs.next()) {
                    int id = rs.getInt("id");
                    String v_title = rs.getString("v_title");
                    int v_number = rs.getInt("v_number");
                    vote = new vote(id,v_title,v_number);
                    votes.add(vote);
                }
                return votes;
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return null;
            }finally {
                //关
                DBUtil.closeAll(rs,pstmt,DBUtil.con);
            }
        }
    
    }
    
    

    4.设计BLL层(user+vote)

    package Bean;
    
    public class userService {
        userDao userDao = new userDao();
    
        //查询(判断是否存在)+增
        public boolean addUser(user user) {
            //不存在时增
            if (!userDao.isQueryExistByName(user.getU_name()))
                return userDao.addUser(user);
            else
                return false;
        }
    
        public user queryUserById(int id) {
            return userDao.queryUserById(id);
        }
    
        public user queryUserByName(String u_name) { return userDao.queryUserByName(u_name); }
    
        //登录验证
        public boolean loginUserQuery(String uname,String pwd){
            return userDao.loginUserQuery(uname, pwd);
        }
    }
    
    
    package Bean;
    
    import java.util.List;
    
    public class voteService {
        voteDao voteDao = new voteDao();
    
        public boolean updateVote(int id){
            if (voteDao.isQueryExistById(id))
                return voteDao.updateUserById(id);
            else
                return false;
        }
    
        public List<vote> queryAllVote() {
            return voteDao.queryAllVote();
        }
    }
    
    

    六、 将之前写过的DBUtil也变为JavaBean(先导mysql-connect-xxxxx.jar 下载地址:https://dev.mysql.com/downloads/file/?id=496589)
    纠正!----->这个lib文件里放的是mysql-connect.xxxx.jar文件,而这个lib文件不应该放在web文件夹下,应该放在WEB-INF文件夹下然后as a library------正确操作如下:

    错误示范:

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    ---------------------------------------------------------------------------------------------------------------------
    正确示范:
    在这里插入图片描述在这里插入图片描述

    package Bean;
    
    import java.sql.*;
    
    
    public class DBUtil {
        private static final String URL = "jdbc:mysql://localhost:3306/jspwork?characterEncoding=utf8";
        private static final String ADMINNAME = "root";
        private static final String ADMINPWD = "2511880";
    
        public static Connection con = null;
        public static PreparedStatement pstmt = null;
        public static ResultSet rs = null;
    
        public static Connection getConnection() throws ClassNotFoundException, SQLException {
            Class.forName("com.mysql.cj.jdbc.Driver");
            return con = DriverManager.getConnection(URL,ADMINNAME,ADMINPWD);
        }
    
        public static PreparedStatement createPreparedStatement(String sql,Object[] params) throws SQLException, ClassNotFoundException {
            pstmt = getConnection().prepareStatement(sql);
            //不知道需要几个pstmt.setXXX 不知道每个set的类型 所以:
            if (params != null) {
                for (int i = 0; i < params.length; i++) {
                    pstmt.setObject(i + 1, params[i]);
                }
            }
            return pstmt;
        }
    
        public static void closeAll(ResultSet rs,Statement stmt,Connection con){
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
                if (con != null) con.close();
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
        }
    
        //更新
        public static boolean excuteUpdate (String sql,Object[] params){
    
            try {
                getConnection();
                //预编译+执行
                pstmt =createPreparedStatement(sql,params);
                int count = pstmt.executeUpdate();
                if (count > 0)
                    return true;
                else
                    return false;
    
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return false;
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return false;
            } catch (Exception e){
                e.printStackTrace();
                return false;
            } finally {
                //关
                closeAll(null,pstmt,con);
            }
    
        }
    
        //查询
        public static ResultSet executeQuery(String sql,Object[] params){
    
            try {
                getConnection();
                //预编译
                pstmt =createPreparedStatement(sql,params);
                //执行查询
                rs = pstmt.executeQuery();
                return rs;
    
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return null;
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return null;
            } catch (Exception e){
                e.printStackTrace();
                return null;
            }
        }
    
        //登录查
        public static boolean loginQuery(String sql,Object[] params){
            try {
                getConnection();
                //预编译
                pstmt =createPreparedStatement(sql,params);
                //执行查询
                rs = pstmt.executeQuery();
                return rs.next();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return false;
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                return false;
            } catch (Exception e){
                e.printStackTrace();
                return false;
            }
        }
    }
    

    七、 将Bean变为JavaBean具体步骤
    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述
    注:(JavaBean是无法编辑的,修改JavaBean的内容要从原来src下的Bean去修改,修改后debug重启tomcat)
    1.在web下创建一个classes设置为Excluded
    2.将src下的Bean文件直接复制到classes下
    3.设置路径
    4.用debug模式重启tomcat

    八、 制作前端页面+后端(简述,代码将在最后展示)
    注:一开始登录和注册前后端是分开写的,后面因为懒就写在了一起。。。
    1.用户登录页面—>index.jsp
    在这里插入图片描述
    2.用户注册页面—>registerIndex.jsp

    在这里插入图片描述

    3.进入投票主界面—>voteIndex.jsp
    在这里插入图片描述
    4.进入参与投票界面—>joinVote.jsp

    在这里插入图片描述
    5.进入查询投票结果—>voteResult.jsp

    在这里插入图片描述
    6.代码展示(按照顺序对应上面五个图片jsp+css+文件结构)

    在这里插入图片描述

    <%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/28
      Time: 16:25
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
      <meta charset="UTF-8">
      <title>登录</title>
      <link rel="stylesheet" href="all.css">
      <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
    <form action="loginChe.jsp" method="POST">
      <div class = "login">
        <h1 align="center">登入</h1>
        <input type="text" value="" name="username"  placeholder="UserName" class="utxt1" ><br/><br/>
        <input type="password" value="" name="userpwd"  placeholder="UserPassword" class = "utxt1"><br/><br/>
    
        <input type="submit" value="登录" class="submit1" >
        <br/><br/>
        <a href="register/registerInex.jsp"><input type="button" value="注册" class="submit1" ></a>
      </div>
    </form>
    </body>
    </html>
    
    
    <%@ page import="Bean.user" %>
    <%@ page import="Bean.userService" %><%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/29
      Time: 20:45
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>验证</title>
        <link rel="stylesheet" href="all.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
    <div class = login>
    <%
        userService userService = new userService();
        user user = null;
        boolean flag = false;
    
        request.setCharacterEncoding("utf-8");
    
        String jname = request.getParameter("username");
    
        String jpwd = request.getParameter("userpwd");
    
        flag = userService.loginUserQuery(jname,jpwd);
    
        if (flag == true)
            response.sendRedirect("voteIndex.jsp");
        else {
            out.print("密码错误!4秒后跳回主页,请重新登录");
            response.setHeader("Refresh","4;URL=index.jsp");
        }
    %>
    </div>
    </body>
    </html>
    
    
    
    body{
        background-image: url("image/bg.jpg");
        background-repeat: no-repeat;
        background-size: 100%;
    }
    .login{
        width: 300px;
        height: 325px;
        background:gainsboro;
        position: absolute;
        left: 200px;
        top: 200px;
        opacity: 0.8;
        box-shadow: 12px 12px 2px 1px #012;
    }
    .utxt1{
        height: 28px;
        position:relative;
        left: 65px;
    }
    .submit1{
        width: 165px;
        height: 40px;
        position: relative;
        left: 65px;
        background: gray
    }
    
    
    
    <%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/28
      Time: 16:33
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>注册</title>
        <link rel="stylesheet" href="registerAll.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
        <form action="regCheck.jsp" method="post">
            <div class = "register">
                <h1 align="center">注册</h1>
                <input type="text" value="" name="username"  placeholder="UserName" class="utxt1" ><br/><br/>
                <input type="password" value="" name="userpwd"  placeholder="UserPassword" class = "utxt1"><br/><br/>
    
                <input type="submit" value="注册" class="submit1" >
                <br/><br/>
                <a href="../index.jsp"><input type="button" value="返回" class="submit1" ></a>
            </div>
        </form>
    </body>
    </html>
    
    <%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/28
      Time: 16:47
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ page import="Bean.userService" %>
    <%@ page import="Bean.user" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>验证</title>
        <link rel="stylesheet" href="registerAll.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
    <div class = "register">
    <%
        userService userService = new userService();
        user user = null;
        boolean flag = false;
        //解决乱码
        request.setCharacterEncoding("utf-8");
        //获取注册用户名
        String jname = request.getParameter("username");
        //获取注册密码
        String jpwd = request.getParameter("userpwd");
        //打包
        user = new user(jname,jpwd);
        flag = userService.addUser(user);
        if (flag == true)
            out.print("注册成功!,6秒后跳回主页");
        else
            out.print("注册失败!,6秒后跳回主页");
        response.setHeader("Refresh","6;URL=../index.jsp");
    %>
    </div>
    </body>
    </html>
    
    body{
        background-image: url("image/bg.jpg");
        background-repeat: no-repeat;
        background-size: 100%;
    }
    
    .register{
        width: 300px;
        height: 325px;
        background:gainsboro;
        position: absolute;
        left: 200px;
        top: 200px;
        opacity: 0.8;
        box-shadow: 12px 12px 2px 1px #012;
    }
    
    .utxt1{
        height: 28px;
        position:relative;
        left: 65px;
    }
    .submit1{
        width: 165px;
        height: 40px;
        position: relative;
        left: 65px;
        background: gray
    } 
    
    <%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/29
      Time: 19:59
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>投票</title>
        <link rel="stylesheet" href="vote.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
        <form action="" method="post">
            <div class="box">
                <h2 align="center">欢迎来到在线投票系统</h2>
                <br/>
                <h3 align = "center">1.参与投票<a href="joinVote.jsp"><input type="button" class = "bt" value="确定"></input></a></h3>
                <br/>
                <h3 align = "center">2.查看投票结果<a href="voteResult.jsp"><input type="button" class = "bt" value="确定"></input></a></h3>
                <br/>
                <h3 align = "center">3.更换用户<a href="index.jsp"><input type="button" class = "bt" value="确定"></input></a></h3>
                <br/>
                <h3 align = "center">4.管理员登录(暂未开通)<a href=""><input type="button" class = "bt" value="确定"></input></a></h3>
    
            </div>
        </form>
    
    </body>
    </html>
    
    body{
        background-image: url("image/bg.jpg");
        background-repeat: no-repeat;
        background-size: 100%;
    }
    
    .box{
         width: 400px;
         height: 425px;
         background:gainsboro;
         position: absolute;
         left: 36%;
         top: 26%;
         opacity: 0.8;
         box-shadow: 12px 12px 2px 1px #012;
     }
    
    .bt{
        width: 50px;
        height: 25px;
        position: relative;
        left: 40px;
        background: gray
    }
    
    <%@ page import="java.util.List" %>
    <%@ page import="Bean.vote" %>
    <%@ page import="Bean.voteService" %><%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/30
      Time: 8:46
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>参加投票</title>
        <link rel="stylesheet" href="join.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
    <form action="joinVote.jsp" method="post">
        <div class = "voteBox">
            <h2 align="center">投票列表</h2>
        <h3><input type="checkbox" value="1" name = "votePro"/>1.是否召开班会,同意请投票</h3>
        <h3><input type="checkbox" value="2" name = "votePro"/>2.是否重新竞选班干部,同意请投票</h3>
        <h3><input type="checkbox" value="3" name = "votePro"/>3.周二下午上课,同意请投票</h3>
        <h3><input type="checkbox" value="5" name = "votePro"/>4.关于暑假不放假留校补课通知,同意请投票</h3>
        <h3><input type="checkbox" value="6" name = "votePro"/>5.关于寒假不放假留校进行党课学习,同意请投票</h3>
        <h3><input type="checkbox" value="7" name = "votePro"/>6.关于提前缴纳学费,同意请投票</h3>
        <input type="submit" value="确定投票" align="center" class = "joinSubmit">
        </div>
    </form>
        <div class="show">
    <%
        boolean flag = false;
        voteService voteService = new voteService();
        String[] checkID = request.getParameterValues("votePro");
        if (checkID != null) {
    
            int size = java.lang.reflect.Array.getLength(checkID);
    
            for (int i = 0; i < size;i ++){
                int id = Integer.parseInt(checkID[i]);
                flag = voteService.updateVote(id);
            }
        }
        out.print("<p align = 'center' color = '#E0E3DA'>显示结果</p>");
        if (flag == true) {
            out.print("<p align = 'center' color = '#E0E3DA'>投票成功(3秒后回到主页)</p>");
            response.setHeader("Refresh","3;URL=voteIndex.jsp");
        }
    %>
        </div>
    </body>
    </html>
    
    body{
        background-image: url("image/bg.jpg");
        background-repeat: no-repeat;
        background-size: 100%;
    }
    
    .voteBox{
        width: 750px;
        height: 425px;
        background:gainsboro;
        position: absolute;
        left: 400px;
        top: 80px;
        opacity: 0.8;
        box-shadow: 12px 12px 2px 1px #012;
    }
    
    .show{
        width: 300px;
        height: 100px;
        background:gainsboro;
        position: absolute;
        left: 625px;
        top: 550px;
        opacity: 0.8;
        box-shadow: 12px 12px 2px 1px #012;
    }
    .joinSubmit{
        width: 65px;
        height: 40px;
        position: relative;
        left: 340px;
        top:20px;
        background: #383A3F;
    }
    
    
    <%@ page import="Bean.vote" %>
    <%@ page import="Bean.voteService" %>
    <%@ page import="java.util.List" %><%--
      Created by IntelliJ IDEA.
      User: 11244
      Date: 2021/6/30
      Time: 14:35
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>投票结果</title>
        <link rel="stylesheet" href="result.css">
        <link rel="shortcut icon" href="image/ll.ico" type="image/x-ico">
    </head>
    <body>
        <div class="rBox">
            <h2 align="center">投票结果列表</h2>
            <%
                voteService voteService = new voteService();
                request.setCharacterEncoding("utf-8");
                List<vote> votes = null;
                votes = voteService.queryAllVote();
                for(int i = 0;i < votes.size();i++) {
                    out.print("<br/>");
                    vote vote = (Bean.vote)votes.get(i);
                    out.println("<h4 align = 'center'>"+vote.getId()+". "+vote.getV_title()+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+vote.getV_number()+"票"+"</h4>");
                }
            %>
        <a href="voteIndex.jsp"> <input type="button" value="返回主界面" class="resultSubmit"></a>
        </div>
    
    </body>
    </html>
    
    
    body{
        background-image: url("image/bg.jpg");
        background-repeat: no-repeat;
        background-size: 100%;
    }
    
    .rBox{
        width: 750px;
        height: 650px;
        background:gainsboro;
        position: absolute;
        left: 400px;
        top: 50px;
        opacity: 0.8;
        box-shadow: 12px 12px 2px 1px #012;
    }
    .resultSubmit{
        width: 80px;
        height: 40px;
        position: relative;
        left: 340px;
        top:20px;
        background: #566270;
    }
    
    

    7.所用到的图片
    在这里插入图片描述

    九、总结:

    展开全文
  • 基于JavaWeb的影视评论网站设计与实现 毕业论文+项目源码及数据库文件 系统说明: 摘 要 随着时代的发展,互联网的出现,给传统影视行业带来的最大便利就是,方便了影视从业人员以及爱好者的交流和互动,而为用户提供...
  • [JavaWeb]谁是卧底游戏制作(网络游戏)

    千次阅读 2020-05-03 21:47:01
    Hello,I'm Shendi,这次我制作了谁是卧底游戏(制作周期三天). 这里我写了一篇关于这个制作的教程,并附带了源码 下面是运行效果. 目录 主要技术 整理思路 开始界面实现 房间列表界面(快速开始,进入房间) ...
  • javaweb 23

    2017-06-15 19:31:28
    有序列表ol li(type属性更改序号类型,案例:投票喜欢的女明星) 无序列表ul li(用于条目的罗列,type属性更改序号类型,案例:学生管理系统) 项目列表标签(dl dt dd)(一般用于有层次结构的列表,一个公司...
  • 业务越来越复杂,我们不得不把某些业务放到一个机器(或集群)上,把另外一部分业务放到另外一个机器(或集群)上,虽然系统的计算能力,处理能力大大增强,但是这些系统之间的通信就变成了头疼的问题,消息队列(MQ...
  • 分享一些Javaweb,JavaSwing项目

    千次阅读 2020-06-27 19:55:53
    基于swing+mysql的搏击俱乐部管理系统 基于spring+mybatis的ssm失物招领管理系统 基于jsp+spring+hibernate+struts2的ssh招聘网站,包含设计文稿 基于jsp+mysql的网络教学平台(设计文稿+答辩ppt+开题报告) 基于jsp...
  • 第17章编程实训2——投票系统改进版和成绩输入系统 17.1案例1——基于表单的投票系统 17.1.1案例需求 17.1.2投票系统分析 17.1.3开发过程 17.1.4存在的问题 17.2案例2——成绩输入系统 17.2.1案例需求 17.2.2系统...
  • 同时用户可以对自己喜欢的电影投票,还可欣赏最新电影的预告片、查看电影海报等。网站旨在为喜爱电影的网友提供一个分享交流的平台。电影不仅是人们普遍喜爱的娱乐方式,也是一种电影制作者表达的艺术形式,而电影...
  • 在java培训中,有系统全面的理论知识和企业级实践项目,可以让你真正掌握java知识和技能,更好的开发项目。这样,要更改按钮或链接,您只需在一个文件中进行更改,它将自动呈现在网站的任何位置。Java 服务器页面 ...
  • WEB入门.八 背景特效

    千次阅读 2017-02-18 20:19:19
    学习内容 background属性CSS Sprite 技术 滑动门技术能力目标使用background设置网页背景 使用Sprites制作平滑投票特效使用滑动门技术实现Tab菜单本章简介在前面章节中,已经系统地讲解了页面设计中常见的布局...
  • 商品描述:基本信息书名:JavaWeb程序设计定价:39.50元作者:郭克华,奎晓燕,卜凡,池涛著出版社:清华大学出版社出版日期:2016-11-01ISBN:9787302446118字数:页码:版次:装帧:平装开本:16开商品重量:编辑...
  • 基于java的一个有创意的web毕设题目

    千次阅读 2020-12-22 14:35:24
    基于java的一个有创意的web毕设题目一个有创意的web毕设题目本课题将结合基于Java Web技术的名师一对一课程预约系统,根据本课题的最终目标,在线用户注册、相关信息发布、在线咨询、预约试听课程、课程主要学习内容...
  • java毕业设计题目大全

    万次阅读 多人点赞 2019-05-19 13:57:33
    工资绩效管理系统的开发 电子产品销售网站的设计与实现 酒店预订信息管理系统的设计 成绩管理系统 B2C的电子商务系统(J2EE) B2C购物网站设计 教学网站及网上考试系统的设计与实现 ERP采购系统 IC卡管理系统 ...
  • android安卓源码海量项目合集打包-1

    万次阅读 多人点赞 2019-06-11 16:16:24
    两端使同一套的图片,防止两端因为系统内置的Emoji表情不一样,而造成用户体验不一致.rar │ │ Android 软键盘和emoji表情切换方案,和微信几乎一样的体验.rar │ │ Android即时通讯中Emoji表情的集成,给出了一...
  • Java Web开发课堂实录

    2021-04-28 09:00:05
    章静态网页设计1.1HTML简介1.2HTML文档结构1.3HTML页面标记1.3.1基本标记1.3.2列表标记1.3.3表格1.3.4表单1.4CSS简介1.5CSS页面样式1.5.1CSS样式语法1.5.2CSS属性1.5.3使用CSS的方式1.6实例应用:制作个人主页1.6.1...
  • Java相关的毕业论文,期刊600篇,涵盖Java,jsp,html,ssh,mysql等相关的毕业论文,期刊600篇
  • 基于jsp的在线电影网站

    千次阅读 2020-10-25 21:06:41
    在线电影网的设计可以实现前台的影片在线播放、影片下载、影片评论、找回密码等功能,也可实现后台的会员管理、影片管理、投票管理、新闻管理、公告管理等功能。该系统采用B/S结构模型,基于java Web开发该系统,给...
  • JAXP提供了命名空间支持,使你的应用程序能够处理那些存在命名冲突的模式,它的制作方式非常灵活,允许你在应用程序中使用符合XML的XSL处理器。 7.Java命名和目录接口 顾名思义,它提供命名和目录特性,使应用程序...
  • 实例038 在Windows Server 2003系统下安装和配置邮件服务器 实例039 配置开源邮件服务器Apache James Server 实例040 安装和配置Magic Winmail邮件服务器 2.2 应用JavaMail组件发送邮件 实例041 发送普通格式的邮件 ...
  • 家装设计公司客户关系系统 基于机器学习的文本语义分析工具 基于微信小程序的私教预约系统 标准化轮胎仓库管理系统 公务机典型试飞科目数据处理系统 基于图像的结构化数值识别系统的设计与实现...
  • 开发工具: Java文件大小: 1371 KB上传时间: 2014-06-09下载次数: 23提 供 者: 松楷详细说明:基于Java Web的后台管理系统, 数据库和源代码都有,是个学习的好资料,强烈推荐!-Java Web-based back-office ...

空空如也

空空如也

1 2 3
收藏数 56
精华内容 22
热门标签
关键字:

javaweb投票系统的制作