These techniques are used here to display a tree list of accounting accounts. You can also turn pages up and down. Hope it helps those in need. The functions of each part are as follows
1. JAVABEAN: DB is mainly used to obtain account records from the database.
2. The javascript function action is mainly used to dynamically set the page to which the hyperlink should jump based on the current subject number.
3. The structure of the entire list is controlled by JAVA fragments.
Main code:
<font size="-1">Income account:</font></div>
<ul>
<%
int pageLine=15;
int totalRec=0;
int intPage=1;
int i;
if (request.getParameter("page")!=null)
intPage=Integer.parseInt(request.getParameter("page"));
try{
totalRec=DB.counttype(1);
}
catch(Exception e){
e.printStackTrace();
}
int intPageCount=0;
intPageCount=(totalRec+pageLine-1)/pageLine;
%>
<% Collection items= DB.getkemustype(1);
Iterator it=items.iterator();
if (intPageCount>0)
{
for(i=1;i<=(intPage-1)*pageLine;i++)
it.next();
for(i=1;i<=pageLine;i++){
if(it.hasNext()){
kemudetails kemudetails =(kemudetails)it.next();
%>
<li >
<A HREF='javascript:action(<%= convert(kemudetails.getKMH() ) %>)' >
<font size="-1"><%= convert(kemudetails.getNAME()) %></font></font></A>
</li>
<%
}
}
}
%>
</ul>
http://blog.csdn.net/daisy423xu/archive/2007/02/08/1505425.aspx