UserBean.java是个实体类。
Welcome.jsp中:
<tr><td>ID</td><td>姓名</td><td>年龄</td></tr>
<%
int pageNow = 1;
String szPageNow = request.getParameter("pageNow");
if(szPageNow != null)
{
pageNow = Integer.parseInt(szPageNow);
}
ArrayList al = (ArrayList)request.getAttribute("result");
for(int i=0;i<al.size();i++)
{
UserBean ub = (UserBean)al.get(i);
%>
<tr><td><%=ub.getId()%></td>
<td><%=ub.getName()%></td>
<td><%=ub.getAge()%></td></tr>
<%
}
////从object --> string --int
int pageCount = Integer.parseInt((String)request.getAttribute("pageCount")) ;
//int pageCount = ubd.getPageCount();
for(int i=1;i<pageCount;i++){
%>
<a href=UserDL?pageNow=<%=i%>><<%=i%>></a>