📄 answeraction.java
字号:
/**
*
*/
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -