layer分页前台

这是一个关于在Java Web应用中使用Layer框架进行前端分页操作的代码片段。内容涉及导入相关库,如JSONObject、JSONArray,以及与文件操作相关的类。同时,代码中包含JSP页面的路径处理和字符编码转换,使用了C3P0数据源连接,以及一些实用工具类。
摘要由CSDN通过智能技术生成

package com.system.file.ftp.action;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;

import org.apache.poi.hssf.record.formula.functions.Count;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.system.action.SystemAction;
import com.system.common.Constants;
import com.system.common.IpUtils;
import com.system.db.C3P0Utils;
import com.system.file.model.Prog;
import com.system.file.model.TBFile;
import com.system.file.utils.FilePath;
import com.system.utils.Tools;

@SuppressWarnings(“serial”)
public class FileAction extends SystemAction {

@SuppressWarnings("unchecked")
public String list() {
	String tf_name = res.getParameter(request, "tf_name", "");
	String hql = "";
	String total_hql = "";
	if(!"".equals(tf_name)){
		hql = "from TBFile f where (f.tf_relName like '%" + tf_name + "%' or f.tf_no like '%" + tf_name
				+ "%') and f.tf_state = '1' order by f.tf_inputdate";
		total_hql = "select count(tf_id) total from tb_file f where f.tf_state='1' and tf_name like '%"+ tf_name +"%'";
		request.setAttribute("tf_name", tf_name);
	}else{
		total_hql = "select count(tf_id) total from tb_file f where f.tf_state='1'";
		hql = "from TBFile f where f.tf_state = '1' order by f.tf_inputdate desc";
	}
	Integer total=C3P0Utils.getTotal(total_hql);
	//int total = systemService.getTotal(hql);
	request.setAttribute("total", total);
	// 有多少页可以浏览
	int countPage = (total / Constants.WEBPAGESIZE) + (total % Constants.WEBPAGESIZE > 0 ? 1 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值