資源簡(jiǎn)介
利用struts與hibernate實(shí)現(xiàn)在線考試系統(tǒng),驗(yàn)證碼登錄,題目分頁(yè)顯示,可以更改每頁(yè)顯示題目條數(shù),并進(jìn)行動(dòng)態(tài)分頁(yè)顯示
代碼片段和文件信息
package?action;
import?java.util.Enumeration;
import?java.util.List;
import?javax.servlet.ServletContext;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpSession;
import?javax.servlet.http.HttpSessionContext;
import?org.apache.struts2.ServletActionContext;
import?com.opensymphony.xwork2.ActionContext;
import?com.opensymphony.xwork2.ActionSupport;
import?dao.IQuestionDao;
import?dao.QuestionDaoImpl;
import?po.*;
import?service.IQuestionService;
import?service.QuestionServiceImpl;
import?vo.PageBean;
public?class?GetQuestionAction?extends?ActionSupport?{
private?IQuestionService?questionService?=?new?QuestionServiceImpl();
private?int?page;
private?int?pageSize;
private?PageBean?pageBean;
public?int?getPage()?{
return?page;
}
public?void?setPage(int?page)?{
this.page?=?page;
}
public?int?getPageSize()?{
return?pageSize;
}
public?void?setPageSize(int?pageSize)?{
this.pageSize?=?pageSize;
}
public?String?execute()?{
pageBean?=?questionService.getPageBean(pageSize?page);
ActionContext.getContext().getSession().put(“pageBean“?pageBean);
return?SUCCESS;
}
}
評(píng)論
共有 條評(píng)論