• 大小: 5.65MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-06
  • 语言: Java
  • 标签: 投票系统  

资源简介

基于jdbc+struts2+jsp+jfreechart开发的投票系统demo 1. jdbc的DAO数据层,分页,使用jfreechart图形显示投票结果,界面的学习参考项目。 可在tomcat6.0+mysql5.0以上版本部署。

资源截图

代码片段和文件信息

package com.sanqing.action;

import java.util.UUID;

import com.opensymphony.xwork2.ActionSupport;
import com.sanqing.bean.Vote;
import com.sanqing.bean.VoteOption;
import com.sanqing.dao.VoteDAO;
import com.sanqing.dao.VoteOptionDAO;
import com.sanqing.daoFactory.VoteDAOFactory;
import com.sanqing.daoFactory.VoteOptionDAOFactory;

public class AddVoteAction extends ActionSupport {
private int channel; // 封装channel参数
private String voteName; // 封装voteName参数
private String[] voteOption;// 封装voteOption参数

public int getChannel() {
return channel;
}

public void setChannel(int channel) {
this.channel = channel;
}

public String getVoteName() {
return voteName;
}

public void setVoteName(String voteName) {
this.voteName = voteName;
}

public String[] getVoteOption() {
return voteOption;
}

public void setVoteOption(String[] voteOption) {
this.voteOption = voteOption;
}

public String execute() throws Exception {
VoteDAO voteDAO = VoteDAOFactory.getVoteDAOInstance();//获得VoteDAO实例
VoteOptionDAO voteOptionDAO = 
VoteOptionDAOFactory.getVoteOptionDAOInstance();//获得voteOption实例
//首先保存投票,然后再保存投票选项
Vote vote = new Vote();
vote.setChannelID(channel);
vote.setVoteName(voteName);
voteDAO.addVote(vote);
//查询投票ID
int voteID = voteDAO.findVoteByName(voteName).getVoteID();
//保存投票选项
for(String voteOptionName : voteOption) {
VoteOption vp = new VoteOption();
vp.setVoteID(voteID);
vp.setVoteOptionName(voteOptionName);
voteOptionDAO.addVoteOption(vp);
}
return this.SUCCESS;
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-20 02:18  votedemo\
     文件        1174  2015-05-20 01:26  votedemo\.classpath
     文件         298  2015-05-20 02:09  votedemo\.mymetadata
     文件        1751  2015-05-20 02:09  votedemo\.project
     文件         209  2015-05-20 02:18  votedemo\readme.txt
     目录           0  2015-05-20 02:18  votedemo\src\
     目录           0  2015-05-20 02:18  votedemo\src\com\
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\action\
     文件        1708  2015-05-20 01:49  votedemo\src\com\sanqing\action\AddVoteAction.java
     文件        1073  2015-05-20 01:48  votedemo\src\com\sanqing\action\DeleteVoteAction.java
     文件        2400  2015-05-20 01:48  votedemo\src\com\sanqing\action\DoVoteAction.java
     文件        1707  2015-05-20 01:48  votedemo\src\com\sanqing\action\ShowVoteAction.java
     文件        2041  2015-05-20 01:25  votedemo\src\com\sanqing\action\ShowVoteByChannelAction.java
     文件        1881  2015-05-20 01:51  votedemo\src\com\sanqing\action\VoteResultAction.java
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\bean\
     文件         464  2015-05-20 01:52  votedemo\src\com\sanqing\bean\Channel.java
     文件         580  2015-05-20 01:52  votedemo\src\com\sanqing\bean\Vote.java
     文件         826  2015-05-20 01:52  votedemo\src\com\sanqing\bean\VoteOption.java
     文件         424  2015-05-20 01:52  votedemo\src\com\sanqing\bean\VoteResult.java
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\dao\
     文件         746  2015-05-20 01:53  votedemo\src\com\sanqing\dao\VoteDAO.java
     文件         531  2015-05-20 01:53  votedemo\src\com\sanqing\dao\VoteOptionDAO.java
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\daoFactory\
     文件         304  2015-05-20 01:54  votedemo\src\com\sanqing\daoFactory\VoteDAOFactory.java
     文件         340  2015-05-20 01:54  votedemo\src\com\sanqing\daoFactory\VoteOptionDAOFactory.java
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\daoImpl\
     文件        7182  2015-05-20 01:54  votedemo\src\com\sanqing\daoImpl\VoteDAOImpl.java
     文件        4809  2015-05-20 01:54  votedemo\src\com\sanqing\daoImpl\VoteOptionDAOImpl.java
     目录           0  2015-05-20 02:18  votedemo\src\com\sanqing\util\
     文件        1834  2015-05-20 01:55  votedemo\src\com\sanqing\util\DBConnection.java
............此处省略136个文件信息

评论

共有 条评论