ArrayList arrayList=(ArrayList)session.getAttribute("FeeTypeCodeValues");
String nfp=request.getParameter("option");
int arrayListSize = arrayList.size();
int NFRecords=0;
log.info("the nfp value="+nfp+"the Nfrecords="+NFRecords);
if(nfp==null)
NFRecords=5;
else
NFRecords=Integer.parseInt(nfp);
log.info("From select box the no of records=========***********"+NFRecords);
log.info("The arralist==="+arrayList);
int NoOfColums=5;
log.info("The Arraylist size=========="+arrayListSize+"========(arrayListSize%5)/5=="+(arrayListSize/NoOfColums)%NFRecords);
int NoOfPages=0;
if((arrayListSize/NoOfColums)%NFRecords==0)
NoOfPages=((arrayListSize/NoOfColums)/NFRecords);//First 5 is for NoOfColumns and Second 5 is for NoOfRecords per page
else
NoOfPages=((arrayListSize/NoOfColums)/NFRecords)+1;
int count=1;
log.info("NoOfPages================="+NoOfPages+"======count=="+count);
// Number of Records that need to displayed per page
int increment = NoOfColums*NFRecords;//Number of Records perpage including colums count(NumberOfColumsperOneRecord*NumberRecords)
int fromIndex = 0;
int toIndex = increment;
boolean check = true;
String uri = request.getRequestURI();
String previous="";
String next ="";
List displayList = null;
if( null != request.getParameter("next"))
{
fromIndex = Integer.parseInt(request.getParameter("next"));
toIndex = increment + fromIndex;
count=Integer.parseInt(request.getParameter("count"));
count++;
if( toIndex+1 > arrayListSize)
{
toIndex = arrayListSize;
check = false;
}
if( fromIndex > arrayListSize)
fromIndex = 0;
}
if( null != request.getParameter("prev"))
{
toIndex = Integer.parseInt(request.getParameter("prev"));
fromIndex = toIndex - increment;
count=Integer.parseInt(request.getParameter("count"));
count--;
}
if(arrayListSize > 0)
{
if(increment > arrayListSize){
toIndex = arrayListSize;
displayList = arrayList.subList(fromIndex, toIndex);
toIndex = 0;
}else{
displayList = arrayList.subList(fromIndex, toIndex);
}
}
if(fromIndex != 0 )
previous = " Previous ";
if(toIndex != 0 && check)
next = " Next ";
Thanks&Regards
Sreenivas Reddy.T
Future is always far but try ro reach "SUCCESS IS SWEET BUT SCREAT IS SWEAT
Blog Archive
Wednesday, October 13, 2010
Friday, June 18, 2010

I am the founder of the Hibernate project, an open source object/relational mapping solution for Java. I recently joined JBoss Inc, so that I could concentrate fulltime on developing Hibernate and building a business around support, training and consulting services. I'm also working hard to bring some of our ideas about persistence into the Java standards, via the JCP process. I've just finished writing a book called "Hibernate in Action" with Christian Bauer.
Observe this all words written himslef.........SreenivasReddy
Subscribe to:
Posts (Atom)
