?? gradeaction.java
字號:
/**
*
*/
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -