answeraction.java
来自「在线考试系统」· Java 代码 · 共 56 行
JAVA
56 行
/**
*
*/
package exam.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import exam.dao.StudentAnswerTable;
import exam.dao.User;
/**
* @author huaying_livingbdoy
*
*/
public class Answeraction extends ActionSupport {
private StudentAnswerTable studentAnswerTable;
public StudentAnswerTable getStudentAnswerTable() {
return studentAnswerTable;
}
public void setStudentAnswerTable(StudentAnswerTable studentAnswerTable) {
this.studentAnswerTable = studentAnswerTable;
}
public String execute(){
System.out.println("**********");
StudentAnswerTable dao=new StudentAnswerTable();
List list=dao.findLogin(studentAnswerTable.getOneaskanswer(), studentAnswerTable.getClass());
if(list.size()==1){
studentAnswerTable=(StudentAnswerTable)list.get(0);
ActionContext context = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) context
.get(ServletActionContext.HTTP_REQUEST);
HttpSession session = req.getSession();
session.setAttribute("action",studentAnswerTable);
}
return SUCCESS;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?