易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

JSON与JAVA数据的转换

关键字: json java
JSON-lib这个Java类包用于把bean,map和XML转换成JSON并能够把JSON转回成bean和DynaBean。
下载地址:http://json-lib.sourceforge.net/
还要需要的第3方包:
org.apache.commons(3.2以上版本)
org.apache.oro
net.sf.ezmorph(ezmorph-1.0.4.jar)
nu.xom
1、List
Java代码
boolean[] bool ......

JAVA—感触

学到JAVA的面对对象,发现如此强大!
万物皆对象,万物为我所用!
对JAVA产生强烈的好感!
但对于Sun公司的收购,JAVA不知会如何?
--------------------------------------------------
这第一篇文章,是我在CSDN的开端。
之后我会更新我的博客,写上一些学习感受。
希望能在这里找到一片新的天地! ......

Java Logger汇总

来自: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  ......

JAVA中字符串知识详解

java中字符串和整型之间的转化
1)如何将字符串转化为整型;
   int i = Integer.parseInt(String str);
   int i = Integer.valueOf().intValue();
 
  注:Integer.parseIn 和 Integer.valueOf 不同,前者生成的是整型,而后者是一个对象,所以要通过intValue()来获得对象的值;
&nb ......

Java开发核心技术面试心得分析

Java的数据结构有哪些?Map与Set的本质区别是什么?
分析:Java常见的数据结构有Collection和Map,其中Collection接口下包括List和Set接口,其下又有多个实现类如List下有ArrayList、LinkedList和Vector等实现类,Set下有HashSet、LinkedSet等实现类和SortedSet接口,HashSet下有LinkedHashSet子类,SortedSet接口下有Tre ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号