gradeaction.java

来自「在线考试系统」· Java 代码 · 共 81 行

JAVA
81
字号
/**
 * 
 */
package com.qgqlyy.exam.grade;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Transaction;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import exam.dao.GradeTable;
import exam.dao.GradeTableDAO;
import exam.dao.StudentAnswerTable;
import exam.hibernate.HibernateSessionFactory;

/**
 * @author huaying_livingbdoy
 *
 */
public class GradeAction extends ActionSupport  {
	private GradeTable gradeTable;
	private List list;

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public GradeTable getGradeTable() {
		return gradeTable;
	}

	public void setGradeTable(GradeTable gradeTable) {
		this.gradeTable = gradeTable;
	}
	StudentAnswerTable dao=new StudentAnswerTable();
	public String execute(){
		System.out.println("**********");
		Transaction t = HibernateSessionFactory.getSession().getTransaction();
		t.begin();
		List list=dao.findLogin(gradeTable.getSelectonepoint(), gradeTable.getOneaskpoint(),gradeTable.getOneaskpoint());
		if(list.size()==1){
			gradeTable=(GradeTable)list.get(0);
			ActionContext context = ActionContext.getContext();
			HttpServletRequest req = (HttpServletRequest) context
					.get(ServletActionContext.HTTP_REQUEST);
			HttpSession session = req.getSession();
			session.setAttribute("action",gradeTable);
		}
		return SUCCESS;

		
	}
	public StudentAnswerTable getDao() {
		return dao;
	}

	public void setDao(StudentAnswerTable dao) {
		this.dao = dao;
	}

	public String selectAll() {
		GradeTableDAO dao = new GradeTableDAO();
	 list= dao.findAll();
		return SUCCESS;
}
}

			


⌨️ 快捷键说明

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