📄 pageaction.java
字号:
package limq.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import limq.common.*;
import limq.hibernate.vo.*;
import java.util.*;
public class PageAction extends BaseDispatchAction{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String pageNo=request.getParameter("pageNo");
String totalcount=request.getParameter("totalcount");
String totalpage=request.getParameter("totalpage");
int pagesize=2;
PageInfo page =new PageInfo();
page.setPageSize(pagesize);
HashMap hp=null;
History[] historys = null;
String stu_name=null;
HttpSession session = request.getSession();
stu_name = (String) session.getAttribute("username");
if(pageNo == null || totalcount == null || totalpage==null){
page.setPageNo(1);
hp=super.getStudentsService().getStudentHistory(page,stu_name);
page.setTatalCount(((Integer)hp.get("totalCount")).intValue());
page.setTotalpage(((Integer)hp.get("totalPage")).intValue());
}else{
page.setPageNo(Integer.parseInt(pageNo));
page.setTatalCount(Integer.parseInt(totalcount));
page.setTotalpage(Integer.parseInt(totalpage));
hp=super.getStudentsService().getStudentHistory(page,stu_name);
}
historys =(History[]) hp.get("history");
request.setAttribute("history",historys);
request.setAttribute("pageinfo",page);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -