Java另一种分页技术
整体系统采用Java中Spring ,Struts, Hibernate组成。
在Action中:
public ActionForward orgview(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) {
// TODO Auto-generated method stub
ActionForward forward = new ActionForward("strpath");
HttpSession session=request.getSession();
String usrid=(String) session.getAttribute("uid");
BxGoods goods=new BxGoods(); //表名
String whe_str=" where c.collectType=0 and c.userId='"+usrid+"'"; //查询的SQL语句
String tableName=" BxCollectGoods as c "; //表名
int dipage =1;
int pageSize =10;
int count = currentPage.allRecord(tableName, whe_str);
int allPage = currentPage.allPage(count, pageSize);
Object d=request.getParameter("d");
if(d!=null)
dipage=Integer.valueOf(d.toString());
List list_cg = currentPage.currentPage(tableName, whe_str, dipage, pageSize, allPage);
List list=new ArrayList();
Iterator iter=list_cg.iterator();
while(iter.hasNext()){
BxCollectGoods cg =(BxCollectGoods) iter.next();
CollectGoods cgBean=new CollectGoods();
String collectname = cg.getCollectName();
String collectId = cg.getCollectId();
goods =goodsDAO.findById(cg.getCollectId());
BxUser bx_user = userDAO.findById(goods.getUserId());
cgBean.setSellerName(bx_user.getUserName());
BxUser user =userDAO.findById(cg.getUserId());
cgBean.setBuyId(cg.getUserId());
cgBean.setCollectName(cg.getCollectName());
cgBean.setCollectType(cg.getCollectType());
cgBean.setRecaddTime(cg.getAddTime());
cgBean.setCollectId(cg.getCollectId());
cgBean.setShopPrice(goods.getShopPrice());
cgBean.setGoodsName(goods.getGoodsName());
cgBean.setRecId(cg.getRecId());
cgBean.setGoodsImg(goods.getGoodsThumb());
list.add(cgBean);
}
request.setAttribute("list", list);
request.setAttribute("d",dipage);
request.setAttribute("count",count);
request.setAttribute("allPage",allPage
相关文档:
java ip地址转换为长整型;
public class Util {
/**
* 字符串ip转换为long
* @param 字符串ip
* @return
*/
public static long getStr ......
public static void replaceString(String source,String oldStr,String newStr){
System.out.println(source);
String result = source.replaceAll("(?i)"+oldStr
, newStr); //大小写不敏 ......
安装开发环境
ubuntu9.10下安装JAVA开发环境其实还是比较简单的,我们就以安装常用的jdk、eclipse、tomcat、svn client(找到一个可以和windows中的小乌龟类似的但安装还有点问题解决后会补上)、oracle client为例讲讲如何安装(本文中自动化安装脚本下载http://download.csdn.net/source/2034239,文件太大分成6份 )。前 ......
来自:http://www.cnblogs.com/echozhjun/archive/2010/01/08/1641970.html
JDK Logger
JDK Logger在java.util.logging包下面,自从JDK1.4就有了,可是因为log4j的存在,这个Logger一直沉默着。Java自带的Logger,级别比Log4j还要详细,但是如果需要自定义日志输出格式,需要自己实现Formatter,有些不方便。
Log4j  ......
StringTokenizer 这个类其实真正项目里面恐怕很少会用吧?但是这个类真的很实用,因为它可以根据自己的方式按照一定的规则来拆分一个字符串
String s = new String("The Java platform is the ideal platform for network computing");
//默认的构造函数,会 ......