<%@page contentType="text/html;charset=gb2312"%>
<%@include file="public.jsp"%>
<%
//参数说明
//数据查询条件,值域:timeout/allorder
String condition=getString(request,"condition","allorder");
%>
<%
ObjectSession objectSession=null;
List list_data=null;
new ObjectSessionFactory().close();try{
objectSession = new ObjectSessionFactory().open();
    list_data=objectSession.find("from User");
}catch(Exception e){
System.out.println(e);
}%><style type="text/css">
<!--
.style5 {font-size: 13px; }
-->
</style> <table width="97%" height="22%" border="0" >
  <tr height="8%" >
    <th width="10%"scope="col"><div align="left"><a href="./user_list.jsp">人员信息</a></div></th>
    <th width="10%"scope="col"><div align="left"><a href="#" onclick="parent.detailFrame.location.replace('./user_new.jsp')">新增人员</a></div></th>
    <th width="11%"scope="col"><a href="./group_list.jsp">群组信息</a></th>
    <th width="11%"scope="col"><a href="#"  onclick="parent.detailFrame.location.replace('./group_new.jsp')">新增群组</a></th>
    <th width="12%"scope="col">&nbsp;</th>
    <th width="9%"scope="col">&nbsp;</th>
    <th width="9%"scope="col">&nbsp;</th>
    <th width="9%"scope="col">&nbsp;</th>
    <th width="9%"scope="col">&nbsp;</th>
  </tr>
  <tr>
    <th height="88" colspan="10" scope="row"><table width="100%" border="0" cellspacing="1" bgcolor="#666666">
        <tr bgcolor="#CCCCCC">
          <th width="122" height="16" scope="col"> <div align="left" class="style5">
              <div align="center">姓名</div>
          </div></th>
          <th width="131" scope="col"><div align="left" class="style5">
              <div align="center">用户</div>
          </div></th>
          <th width="105" scope="col"><div align="left" class="style5">
              <div align="center">群组</div>
          </div></th>
          <th width="149" scope="col"><div align="left" class="style5">
              <div align="center">手机号码</div>
          </div></th>
          <th width="115" scope="col"><div align="left" class="style5">邮件地址</div></th>
          <th width="177" scope="col">
            <div align="center" class="style5">
              操作
          </div></th>
        </tr>
        <%
    for(int i=0;list_data!=null&&i<list_data.size();i++){
       User user=(User)list_data.get(i);
   Iterator it=null;
   try{
 Set groupSet=user.getGroups();
 it=groupSet.iterator();
   }catch(Exception e){
 it=null;
   }
   String groupInfo=""; 
   for(int k=0;it!=null&&it.hasNext();){
  groupInfo+=" "+((Group)it.next()).getName();
   }
   
  
  %>
        <tr bgcolor="#FFFFFF">
          <th scope="row"><div align="left"><%=getISO8859(user.getName())%></div></th>
          <td><div align="left"><%=getISO8859(user.getUsername())%></div></td>
          <td><%=getISO8859(groupInfo)%></td>
          <td><%=getISO8859(user.getMobileTel())%></td>
          <td><%=getISO8859(user.getEmail())%></td>
          <td class="style5"><a href="#" onclick="parent.detailFrame.location.replace(this.url)" url="detailForm.jsp?id=<%=user.getForm().getId()%>">查看明细</a></td>
        </tr>
        <%}%>
    </table></th>
  </tr>
</table>

解决方案 »

  1.   


    //分页显示结果用参数
         int EveryPage=10;//每页显示的记录数;
         int OnPage=1; //当前显示的页数;
         int Total=0;//记录的总数;
         int TotalPage=0;//记录的总页数;
         java.util.Vector result = (java.util.Vector)v.get(1);
         System.out.println("v.get(1)"+result.toString()+"\n");
         Total = result.size();
         if(Total%EveryPage==0)
         TotalPage=Total/EveryPage;
         else
         TotalPage=Total/EveryPage+1;
     //取得文本框输入的值;
    String Pages=request.getParameter("Pages");if(Pages!=null)
    {
     OnPage=Integer.parseInt(Pages);//把Pages转换为整型;
     //根据输入的值,判断应显示的页;
     if(OnPage>TotalPage)
     {
      OnPage=TotalPage;
     }
     else if(OnPage<=0)
     {
      OnPage=1;
     }
    }
    System.out.println("nnd is over!");%>
    <link href="/style.css" rel="stylesheet" type="text/css"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr align="center" valign="middle">
        <td height="13" colspan="3"><div align="center"></div></td>
      </tr>  <tr>
        <td width="82%" align="center" valign="top"><div align="center">
       <!--
          <form action="" method="post" name="register" target="_self" id="register">
          -->
            <table width="100%"  border="0" cellpadding="3" cellspacing="1">
              <tr bgcolor="#6595D6">
                <th height="20" colspan="5" scope="col"><span class="style3">标准浏览</span></th>
                </tr>
              <tr bgcolor="#ACC7EA">
                <td width="35%" height="20" bgcolor="#ACC7EA"><div align="center" class="style12">标准编号</div></td>
                <td width="35%" bgcolor="#ACC7EA"><div align="center" class="style12">标准名称</div></td>
                <td width="10%"><div align="center"></div></td>
                <td width="10%">&nbsp;</td>
                <td width="10%">&nbsp;</td>
              </tr>
              <%
             for(int i=1;i<=EveryPage;i++)
                {
                  int j = (OnPage-1)*EveryPage+(i-1);
                  SchemaInfoBean mybean = new SchemaInfoBean();
                  if(j < Total)
                  {
                    mybean = (SchemaInfoBean)result.get(j);
                    }
                  else
                   {
                     break;
                     }        %>          <tr bgcolor="#EEEEEE">
                <td height="19" bgcolor="#EEEEEE"><%=mybean.getSchemaID()%></td>
                <td bgcolor="#EEEEEE"><%=mybean.getSchemaName()%></td>
                <td><div align="center" class="style2"><a href=ViewSchema.jsp?SchemaID=<%=mybean.getSchemaID()%>>查看</a></div></td>
                <td><div align="center" class="style2"><a href=EditSchInfo.jsp?SchemaID=<%=mybean.getSchemaID()%>>修改</a></div></td>
                <td><div align="center" class="style2"><a href=DelSch.jsp?SchemaID=<%=mybean.getSchemaID()%> onclick='javascript:if (confirm("您确定要删除此记录吗?")) {""} else {return false}'>删除</a></div></td>
             </tr>
               <% }          %>
              <tr>
        <form action="BrowseSchema.jsp" method="POST">
                <th colspan="3"><div align="left">标准查询
    <input name="PM" type="text"size="18" height="20">
    <input type="submit" name="query" value="查询" size="20" ></div></th>
       </form>            <th colspan="2">
                 <%
                 for(int i=1;i<=TotalPage;i++)
                 {
                  String p = String.valueOf(i);
                   %>
                  <a href=BrowseSchema.jsp?PM=<%=pm%>&Pages=<%=p%>><%= p %></a>
                  <%
                  }%>
                  </th>
                  </tr>
            </table>
     <!--
            </form>
      -->
          <p>&nbsp;</p>
        </div></td>
      </tr>
      <tr>
        <td colspan="3" valign="top">&nbsp;</td>
      </tr>
    </table>
      

  2.   

    谢谢了,不过数据库部分要用hibernate-3.1.3解决?