addvoteaction.java

来自「一个实用的CMS管理」· Java 代码 · 共 191 行

JAVA
191
字号
package com.suncms.struts2.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.suncms.domain.Article;
import com.suncms.domain.Article_Class;
import com.suncms.domain.Authority;
import com.suncms.domain.NewsFtl;
import com.suncms.domain.Org_Struct;
import com.suncms.domain.Uroles;
import com.suncms.domain.Users;
import com.suncms.domain.Vote_q;

import com.suncms.service.freemarker.MakeNews;
import com.suncms.service.ibatis.ArticleService;
import com.suncms.service.ibatis.UserService;
import com.suncms.service.ibatis.VoteService;


public class AddVoteAction extends ActionSupport{

	private static final long serialVersionUID = 1L;
	private String row_id; 
	private String vote_title; 
	private String vote_type; 
	private String vote_content; 
	private String vote_status; 
	private Date vote_createtime; 
	
	
	private String[] vote_an;
	private List<Vote_q> voteqlist;
	private VoteService voteService = null;
	
	private Vote_q vq=new Vote_q();
	
	
	public Vote_q getVq() {
		return vq;
	}


	public void setVq(Vote_q vq) {
		this.vq = vq;
	}


	public String getVote_content() {
		return vote_content;
	}


	public void setVote_content(String vote_content) {
		this.vote_content = vote_content;
	}


	public String[] getVote_an() {
		return vote_an;
	}


	public void setVote_an(String[] vote_an) {
		this.vote_an = vote_an;
	}


	public VoteService getVoteService() {
		return voteService;
	}


	public void setVoteService(VoteService voteService) {
		this.voteService = voteService;
	}


	public List<Vote_q> getVoteqlist() {
		return voteqlist;
	}


	public void setVoteqlist(List<Vote_q> voteqlist) {
		this.voteqlist = voteqlist;
	}


	public String getRow_id() {
		return row_id;
	}


	public void setRow_id(String row_id) {
		this.row_id = row_id;
	}


	public String getVote_title() {
		return vote_title;
	}


	public void setVote_title(String vote_title) {
		this.vote_title = vote_title;
	}


	public String getVote_type() {
		return vote_type;
	}


	public void setVote_type(String vote_type) {
		this.vote_type = vote_type;
	}


	public String getVote_status() {
		return vote_status;
	}


	public void setVote_status(String vote_status) {
		this.vote_status = vote_status;
	}


	public Date getVote_createtime() {
		return vote_createtime;
	}


	public void setVote_createtime(Date vote_createtime) {
		this.vote_createtime = vote_createtime;
	}

	public String VoteqList() throws Exception {
	
			setVoteqlist(getVoteService().getAllVoteq());
			return "voteqlist";
	

	}
	
	public String addnew() throws Exception {
	
			Vote_q vq = new Vote_q();
			vq.setVote_title(vote_title);
			vq.setVote_status("1");
			vq.setVote_type(vote_type);
			vq.setVote_createtime(new Date());
			vq.setVoteqlist(vote_an);
			vq.setVote_content(vote_content);
			getVoteService().addNewVote(vq);
		
			return "addnew";
	

	}
	
	public String updateVotea() throws Exception {
	
			getVoteService().updateVoteaPolled(vote_an);
			setVq(getVoteService().getVoteResult(row_id));
		
			return "voteresult";
		

	}
	public String execute() throws Exception {
		try {
			return "success";
		} catch (Exception e) {
			e.printStackTrace();
			return "error";
		}

	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?