package com.gc.tool;
import java.util.ArrayList;
import java.util.List;
public class MyPagination {
private int recordCount = 0;
private int pagesize = 0;
private int maxPage = 0;
private int page = 0;
public int getMaxPage(){
int maxPage = (recordCount%pagesize == 0)?(recordCount/pagesize):(recordCount/pagesize+1);
return maxPage;
}
public int getPage(String str){
if(str == null){
str = "0";
}
int page = Integer.parseInt(str);
if(page<1){
&n ......
今天总算把
response.setHeader("progma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);理解了。
//发现问题是这样的
当我点击某一个实体时,转发到一个详细的页面,这个页面包含了一个用于记录访问此页面的人数的文本框,
修改此访问人数后,再一次点击此实体,转到此详细页面后,访问人数没有改变,(数据库中已经更新),最后
我把点击此链接的Action中的方法调出来,加了上面3条语句,结果OK了。太感谢这3条语句的作用了。 ......
水晶易表毕竟是做报表的,离开数据库它是飞不远的。从目前的版本来看,易表连接数据库虽然有好几种方式,但都比较麻烦,而且还有很多局限性。其中通过xml方式连接数据库还算比较灵活,我要说的就是这种方式。
在易表的数据管理里新建一个xml数据连接,如下图:
我的是英文版的,不好意思,以前是中文版来着,后来被windows优化大师给弄成英文版的了,汗。。。
图中标红框的地方最重要,XML Data URL这里填xml的地址,既可以是本机地址也可以是网络地址,左边的红框里是易表传给xml的数据,右边是易表接收xml的数据。
如上图所示,我让易表把年月、税务机关、状态这三个参数传给xml,然后xml用这三个参数查询数据库,把查出的数据再传给易表。
那么关键是这个xml怎么接收数据,怎么查数据库呢?
我来告诉你吧(呵呵,我有种讲课的感觉。),这个xml是不存在的,是让JSP生成的。
因为全是Java代码,所以我没写JSP,直接写了个servlet。废话少说,上代码:
/**
* 与水晶易表进行交互
* 这个方法你可以看做是servlet的doPost方法。
*/
  ......
一简介,
Pager-taglib,支持多种风格的分页显示。实际上她是一个Jsp标签库,为在JSP上显示分页信息而设计的一套标签,通过这些标签的不同的组合,会形成多种不一样的分页页面,风格各异,她自带的DEMO就有七种左右的分页风格,包括Google的分页风格。而需要订制自已的风格的分页页面也非常简单。
分页方式有两种:
一种是从Action中得到一个List,在页面上通过<pg:item>进行自动分页。
第二种是通过把 pageSize,pageNo两参数传给后台进行数据库分页。
我做两个Demo加以说明对比:
二、准备
把pager-taglib.jar放到lib目录下(仅此足亦,完全没必要改web.xml什么的,还有官方war包中的东西都可以不要)
Java代码
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
三,jsp (第一种分页方案由<pg:item>自行分页 )
Java代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/ ......
Properties properties = new Properties();
File file = new File(request.getRealPath("/") +"\\WEB-INF\\classes\\configs.properties");
FileInputStream fiStream = new FileInputStream(file);
InputStreamReader isReader = new InputStreamReader(fiStream,"utf-8");
properties.load(isReader);
String path = properties.getProperty("docpath"); ......
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
ASP:
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-cache, must-revalidate")
JSP:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); ......
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
ASP:
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-cache, must-revalidate")
JSP:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); ......
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
ASP:
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-cache, must-revalidate")
JSP:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); ......
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
ASP:
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-cache, must-revalidate")
JSP:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); ......