⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatevote.java

📁 、好的源码 直接可以运行的哦 大家都来
💻 JAVA
字号:
package sunyang.vote.action.vote;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import sunyang.vote.action.rootaction.VoteRoot;
import sunyang.vote.domain.Vote;

@SuppressWarnings("serial")
public class UpdateVote extends VoteRoot {

	@Override
	public String execute() throws Exception {
		HttpSession session = ServletActionContext.getRequest().getSession();
		//从session中获得投票信息
		Vote vote = (Vote) session.getAttribute("vote");
		//如果页面请求中的投票类型及投票状态与数据库中信息相符,不做操作
		if (vote.getType().equals(type) && vote.getPublish().equals(publish)) {
			return SUCCESS;
		} else {
			//否则,将页面请求中信息更新到数据库
			vote.setType(type);
			vote.setPublish(publish);
			voteService.updateVote(vote);
			return SUCCESS;
		}
	}
}

⌨️ 快捷键说明

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