Java+MYSQL基于ssm在线投票管理系统

随着社会的发展,人们在处理一些问题的时候不同意见越来越多,这源于人们对思想的解放和对社会的认识。所以在处理同一问题上,为了征求不同人的意见在线投票系统诞生了。
传统的投票模式都是通过人工手动填写问卷的方式来进行,这在很大程度上会造成人力和资源上的浪费。随着科技的发展,人们找到了一种新的方式来进行投票,那就是在线投票系统。在线投票系统取代了传统的那种手动问卷的模式。它可以让用户自主地进行投票,不再是那种强迫似的进行问卷。另外一方面就是他是一种不记名投票形式,它可以更加真实的网友反映自己的内心想法。相对传统的投票模式,它具有更加客观更加公正的特点。同时在操作上他也比那种原始的投票方式更加的简单和方便。能够让更多的人进行在线投票,我开发了基于SSM的在线投票系统

Java+MYSQL基于ssm在线投票管理系统_第1张图片界面设计目前已经成为评价软件质量的一条重要指标,一个好的用户界面可以增加用户使用系统的信心和兴趣,提高工作效率,J2EE技术是用JAVA语言作为脚本语言的,J2EE网页为整个服务器端的JAVA库单元提供了一个接口来服务于HTTP的应用程序。 创建动态页面非常方便。用户界面是指软件系统与用户交互的接口,通常包括输出、输入、人-机对话的界面格式等。
1.输出设计
输出是由计算机对输入的原始信息进行加工处理,形成高质量的有效信息,并使之具有一定的格式,提供管理者使用,这是输出设计的主要职责和目标。
系统设计的过程正好和实施过程相反,并不是从输入设计到输出设计,而是从输出设计到输入设计,这是因为输出表格直接与使用者相联系,设计的出发点应当是保证输出表格方便地为使用者服务,正确及时反映和组成用于各部门的有用信息。输出设计的原则是考虑既要全面反映不同管理层的各项需要,又要言简意赅,不要将用户需要和不需要的都提供给用户。
2.输入设计
输入数据的收集和录入是比较费事的,需要大量的人力和一定设备,并且容易出错。如果输入系统的数据有错误,则处理后的输出将扩大这些错误,因此输入数据的正确性对于整个系统质量的好坏是具有决定性意义的。
输入设计的原则有如下几点:
1)输入量应保持在能满足处理要求的最低限度。设计中可采用设置字段初值,下拉式数据窗口等方式尽量减少用户键盘输入量。输入量越少,错误率就越少,数据准备时间也减少。
2)输入的准备及输入过程应尽量容易进行,从而减少错误的发生。
3)应尽量早对输入数据进行检查(尽量接近原数据发生点),以便使错误及时得到更正。
4)输入数据尽早地用其处理所需的形式被记录,以避免数据由一种介质转移到另一种介质时需要转录而可能发生的错误

Java+MYSQL基于ssm在线投票管理系统_第2张图片
Java+MYSQL基于ssm在线投票管理系统_第3张图片
管理员

  1. 对自己的个别信息可以进行修改。
  2. 对投票频道进行添加、修改或删除(已经存在的投票频道不可以再添加)。
  3. 对投票选项进行添加、修改.按编号查询或删除(已经存在的投票选项不可以再添加)。
  4. 对投票结果进行统计,自动生成投票次数最多的前5名。
  5. 对公告栏进行发布、修改或删除。
  6. 可以收集用户留言。
  7. 有良好的登录注册页面,可识别验证码。

Java+MYSQL基于ssm在线投票管理系统_第4张图片

普通用户

  1. 对自己的个别信息可以进行修改。
  2. 可以防止用户重复投票,每个用户每天只可以投票一次,第二天可以再投票(每个投票项每天投票一次,一天不可以同个投票项多次选项。)
  3. 可以按照投票编号进行查询筛选。也可以选择投票频道,浏览投票选项。
  4. 用户可以选择投票频道发布投票选项,已经存在的投票选项不可以再发布,也可以留言给管理员。可以查看投票统计。
  5. 可以查看详细的投票选项内容。可以查看公告,可以查看投票结果。
  6. 有良好的登录注册页面,可识别验证码。

Java+MYSQL基于ssm在线投票管理系统_第5张图片

package com.controller;

import java.io.File;
import java.io.IOException;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.entity.Allusers;
//import com.chengxusheji.po.News;
import com.server.AllusersServer;
import com.util.PageBean;
import net.sf.json.JSONObject;

@Controller
public class AllusersController {
@Resource
private AllusersServer allusersService;

//
@RequestMapping(“showAllusers.do”)
public String showAllusers(int id,ModelMap map,HttpSession session){
/* Map bmap=new HashMap();
bmap.put(“uid”, id);*/
// map.put(“blist”, allusersService.getAll(bmap));
map.put(“allusers”, allusersService.getById(id));
return “read”;
}

@RequestMapping("addAllusers.do")
public String addAllusers(HttpServletRequest request,Allusers allusers,HttpSession session){
	Timestamp time=new Timestamp(System.currentTimeMillis());
	//Users u=(Users)session.getAttribute("user");
	/*if(u==null||u.equals("")){
		return "redirect:showIndex.do";
	}else{*/
		//bbs.setUid(u.getId());
		/*bbs.setPubtime(time.toString());
		bbs.setIsdel("1");*/
	    allusers.setAddtime(time.toString().substring(0, 19));
		allusersService.add(allusers);
		return "redirect:allusersList.do";
	/*}*/
	
	
}

// 处理编辑
@RequestMapping(“doUpdateAllusers.do”)
public String doUpdateAllusers(int id,ModelMap map,Allusers allusers){
allusers=allusersService.getById(id);
map.put(“allusers”, allusers);
return “allusers_updt”;
}
//
@RequestMapping(“updateAllusers.do”)
public String updateAllusers(int id,ModelMap map,Allusers allusers){
allusersService.update(allusers);
return “redirect:allusersList.do”;
}
// 所有List
// @RequestMapping(“allusersList.do”)
// public String allusersList(ModelMap map,HttpSession session){
// map.put(“list”, allusersService.getAll(null));
// map.put(“clist”, allusersService.getAll(null));
// return “allusers”;
// }
// 分页查询
@RequestMapping(“allusersList.do”)
public String goodList(@RequestParam(value=“page”,required=false)String page,
ModelMap map,HttpSession session,Allusers allusers, String username, String pwd, String cx){
/if(session.getAttribute(“user”)==null){
return “login”;
}
/
if(pagenull||page.equals(“”)){
page=“1”;
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put(“pageno”, pageBean.getStart());
pmap.put(“pageSize”, 15);
Map bmap=new HashMap();
Map cmap=new HashMap();
/pmap.put(“uid”, ((Users)session.getAttribute(“user”)).getId());
bmap.put(“uid”, ((Users)session.getAttribute(“user”)).getId());
/
if(username
null||username.equals(“”)){pmap.put(“username”, null);cmap.put(“username”, null);}else{pmap.put(“username”, username);cmap.put(“username”, username);}
if(pwdnull||pwd.equals(“”)){pmap.put(“pwd”, null);cmap.put(“pwd”, null);}else{pmap.put(“pwd”, pwd);cmap.put(“pwd”, pwd);}
if(cx
null||cx.equals(“”)){pmap.put(“cx”, null);cmap.put(“cx”, null);}else{pmap.put(“cx”, cx);cmap.put(“cx”, cx);}

	int total=allusersService.getCount(bmap);
	pageBean.setTotal(total);
	List list=allusersService.getByPage(pmap);
	map.put("page", pageBean);
	map.put("list", list);
	session.setAttribute("p", 1);
	return "allusers_list";
}

// 分页模糊查询
@RequestMapping(“vagueAllusersList.do”)
public String vagueAllusersList(@RequestParam(value=“page”,required=false)String page,
ModelMap map,HttpSession session){
if(page==null||page.equals(“”)){
page=“1”;
}
PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE);
Map pmap=new HashMap();
pmap.put(“pageno”, pageBean.getStart());
pmap.put(“pageSize”, pageBean.getPageSize());
Map bmap=new HashMap();
/pmap.put(“uid”, ((Users)session.getAttribute(“user”)).getId());
bmap.put(“uid”, ((Users)session.getAttribute(“user”)).getId());
/
int total=allusersService.getCount(bmap);
pageBean.setTotal(total);
List list=allusersService.getByPage(pmap);
map.put(“page”, pageBean);
map.put(“list”, list);
session.setAttribute(“p”, 2);
return “queryallusers”;
}
@RequestMapping(“deleteAllusers.do”)
public String deleteAllusers(int id){
allusersService.delete(id);
return “redirect:allusersList.do”;
}

@RequestMapping("quchongAllusers.do")
public void quchongAllusers(Allusers allusers,HttpServletResponse response){
	   Map map=new HashMap();
	   map.put("username", allusers.getUsername());
	   System.out.println("username==="+allusers.getUsername());
	   System.out.println("username222==="+allusersService.quchongAllusers(map));
	   JSONObject obj=new JSONObject();
	   if(allusersService.quchongAllusers(map)!=null){
			 obj.put("info", "ng");
		   }else{
			   obj.put("info", "username可以用!");
			  
		   }
	   response.setContentType("text/html;charset=utf-8");
	   PrintWriter out=null;
	   try {
		out=response.getWriter();
		out.print(obj);
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		out.close();
	}
}

@RequestMapping("Alluserslogin.do")
public String checkAllusersLogin(Allusers allusers, HttpSession session) {
	Map u=new HashMap();
	System.out.println("name===" + allusers.getUsername());
	u.put("username",allusers.getUsername());
	//u.put("utype", "用户");
	//Md5.MD5HexEncode(user.getPassword())
	u.put("pwd",allusers.getPwd());
	allusers = allusersService.allusersLogin(u);
	if (allusers != null) {
		session.setAttribute("username", allusers);
		System.out.println("username=" + allusers);
		session.removeAttribute("suc");
		return "redirect:index.do";
	} else {
		System.out.println("usernafwfwwme=");
		session.setAttribute("suc", "登录失败!用户名或密码错误!");
		return "login";
	}

}

}

你可能感兴趣的:(Java,ssm,java,mysql,数据库)