listsysgroupwithpage.java

来自「用JSP JAVA 做的 系统 只是初来扎到还望西黄!别乱来哦!」· Java 代码 · 共 44 行

JAVA
44
字号
package com.chis.model.user;

import com.stframe.dao.DaoUtil;
import com.stframe.dao.PageUtil;
import com.stframe.form.ActionForm;
import com.stframe.servlet.ActionInstance;

/**
 * 带分页的群组列表
 * @author zxh
 *
 */
public class ListSysGroupWithPage extends ActionInstance{

	public int execute(ActionForm af) throws Exception {
		String shbdwbh = af.getHttpSession().getAttribute("HBDWBH").toString();
		int currentpage = 0;
		int pagesize = 30;
		
		StringBuffer sbsql = new StringBuffer();
		StringBuffer sbpath = new StringBuffer();
		
		//拼凑SQL语句和PATH路径
		sbsql.append("SELECT * FROM SYS_GROUP WHERE 1=1 where HBDWBH='"+shbdwbh+"'");
		
		sbpath.append(af.getHttpRequest().getContextPath()+"/Selevet.do?action=BASE_SYSGROUP_LIST");

		try {
			currentpage = Integer.parseInt(af.getHttpRequest().getParameter("currentpage"));
		} catch (Exception e) {
			currentpage = 1;
		}
		
		
		PageUtil pageUtil = (PageUtil)DaoUtil.selectPage(af.getConnection(),sbsql.toString(),currentpage, pagesize);
		pageUtil.setPath(sbpath.toString());
		
		af.getHttpRequest().setAttribute("grouplist", pageUtil.getContext());
		af.getHttpRequest().setAttribute("pagebar", pageUtil.pageBar());
		return 1;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?