java文件
package bbliberty;
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.servlet.jsp.PageContext;
public class manageclass
{
public String info[];
    private HttpServletRequest request;
    private HttpServletResponse response;
    private PrintWriter out;
    private String PageCount="10";
    
    public  manageclass() throws ClassNotFoundException
    {
      
     }
     public void setResponse(HttpServletResponse response)
    {
     this.response=response;
     }
    public HttpServletResponse getResponse(HttpServletResponse response)
    {
     return this.response;
     }
    public void setRequest(HttpServletRequest request)
    {
     this.request=request;
     }
    public HttpServletRequest getRequest(HttpServletRequest request)
    {
     return this.request;
     }
    public void select(String PageID) throws IOException
    {
      try{
       int Count = Integer.parseInt(PageID)*Integer.parseInt(PageCount);
       if (PageID=="0"||PageID=="1") Count = 0 ;
       String SConut = String.valueOf(Count);
     String str="select * from bookclass order by id limit " + SConut + " , " + PageCount;
        ResultSet result = conndata.conntion(str);
        out=response.getWriter();
        while (result.next())
        { 
         info = new String[8];
         String id=String.valueOf(result.getInt(1));
         info[0]=id;
         System.out.println("this is Sid"+id);
         info[1]=result.getString(2);
         info[2]=result.getString(3);
         out.println("<TR>");
         out.println("<TD class=gridViewItem style='WIDTH: 50px'>");
         out.println("<IMG src='images/bg_class.gif'>");
         out.println("</TD>");
         out.println("<TD class=gridViewItem>"+info[0]+"</TD>");
         out.println("<TD class=gridViewItem>"+info[1]+"</TD>");
         out.println("<TD class=gridViewItem>"+info[2]+"</TD>");
         out.println("<TD class=gridViewItem>");
         out.println("<A class=cmdField href=''>编辑</A></TD>");
         out.println("<TD class=gridViewItem>");
         out.println("<A class=cmdField id=ctl00_ContentPlaceHolder2_GridView1_ctl02_LinkButton1 onclick=\"return confirm('确定要删除吗?');\" href=''>删除</A> </TD>");
         out.println("</TR>");
         System.out.println("This is OKinfoma[]");
         }
        result.close();
               }
        catch(Exception e)
        {
         System.out.println("!!!!!!"+e);
         }
         return;        
     }
     public void PageList() throws IOException
     {
     
      } 
}
显示效果

解决方案 »

  1.   

    jsp文件
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <jsp:useBean id="administrator" scope="session" class="bbliberty.administrator" />
    <jsp:setProperty name="administrator" property="*" />
    <jsp:useBean id="manageclass" scope="session" class="bbliberty.manageclass" />
    <jsp:setProperty name="manageclass" property="*" />
    <%
    administrator.setSession(session);
    administrator.setResponse(response);
    manageclass.setRequest(request);
    manageclass.setResponse(response);
    administrator.Judge();
    String Page_ID;
    if ( request.getParameter("pageid") == null )
    Page_ID = "0";
    else
    Page_ID = request.getParameter("pageid") ;
    %>
    <link href="images/skin.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #EEF2FB;
    }
    -->
    {
     border:solid 1px #DEDEDE;
    }
    legend {
     font-weight:bold;}
     ul, fieldset li{
     border:0; margin:0; padding:0; list-style:none;
    }
     li{
     clear:both;
     list-style:none;
     padding:10px;
    }input{
    float:left;
    font-family: "Tahoma", "Arial", "sans-serif";
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    text-decoration: none;
    background-color:#FFFFFF;
    border-color: #aecde7; 
    border-style: solid; 
    border-width: 1px;
    padding-top: 1px;}
     label{
     width:140px;
     float:left;
     font-family: Arial, Helvetica, sans-serif;
     font-size: 12px;
     line-height: 17px;
     left:auto;
     color: #666666;
    }
    button{ 
      border:0; margin:0; padding:0;
      clear:both;
      width:125px;
      height:31px;
      background:#666666 url(images/button.png) no-repeat;
      text-align:center;
      line-height:31px;
      color:#FFFFFF;
      font-size:12px;
      font-weight:bold;
     }
    fieldset{
     border:solid 1px #DEDEDE;
    }
    fieldset legend {
     font-weight:bold;}
    fieldset ul, fieldset li{
     border:0; margin:0; padding:0; list-style:none;
    }
    fieldset li{
     clear:both;
     list-style:none;
     padding:10px;
    }fieldset input{
     float:left;
    }
    fieldset label{
     width:140px;
     float:left;
    }
    fieldset button{ 
      border:0; margin:0; padding:0;
      clear:both;
      width:125px;
      height:31px;
      background:#666666 url(img/button.png) no-repeat;
      text-align:center;
      line-height:31px;
      color:#FFFFFF;
      font-size:11px;
      font-weight:bold;
     }
     .gridView {
    BORDER-RIGHT: #bad6ec 1px; BORDER-TOP: #bad6ec 1px; BORDER-LEFT: #bad6ec 1px; COLOR: #566984; BORDER-BOTTOM: #bad6ec 1px;FONT-SIZE: 12px 
    }
    {
    FONT-SIZE: 12px
    }
    .gridView {
    BORDER-RIGHT: #bad6ec 1px; BORDER-TOP: #bad6ec 1px; BORDER-LEFT: #bad6ec 1px; COLOR: #566984; BORDER-BOTTOM: #bad6ec 1px;FONT-SIZE: 12px
    }
    .gridViewHeader {
    BORDER-RIGHT: #bad6ec 1px solid; BORDER-TOP: #bad6ec 1px solid; BACKGROUND-IMAGE: url(images/bg_th.gif); BORDER-LEFT: #bad6ec 1px solid; LINE-HEIGHT: 27px; BORDER-BOTTOM: #bad6ec 1px solid
    }
    .gridViewItem {
    BORDER-RIGHT: #bad6ec 1px solid; BORDER-TOP: #bad6ec 1px solid; BORDER-LEFT: #bad6ec 1px solid; LINE-HEIGHT: 32px; BORDER-BOTTOM: #bad6ec 1px solid; TEXT-ALIGN: center;FONT-SIZE: 12px
    }
    .gridViewItemF {
    BORDER-RIGHT: #bad6ec 1px solid; BORDER-TOP: #bad6ec 1px solid; BORDER-LEFT: #bad6ec 1px solid; LINE-HEIGHT: 22px; BORDER-BOTTOM: #bad6ec 1px solid; TEXT-ALIGN: center;FONT-SIZE: 12px
    }
    .cmdField {
    BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND-IMAGE: url(images/bg_rectbtn.png); OVERFLOW: hidden; BORDER-LEFT: 0px; WIDTH: 67px; COLOR: #364c6d; LINE-HEIGHT: 27px; BORDER-BOTTOM: 0px; BACKGROUND-REPEAT: repeat-x; HEIGHT: 27px; BACKGROUND-COLOR: transparent; TEXT-DECORATION: none
    }
    .buttonBlue {
    BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND-IMAGE: url(images/bg_button_blue.gif); BORDER-LEFT: 0px; WIDTH: 78px; COLOR: white; BORDER-BOTTOM: 0px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 21px
    }
     </style>
    <body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
          <tr>
            <td height="31"><div class="titlebt">分类管理</div></td>
          </tr>
        </table></td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
      </tr>
      <tr>
        <td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="100%" valign="top">
             <TABLE class=gridView id=ctl00_ContentPlaceHolder2_GridView1 
          style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellSpacing=0 rules=all 
          border=1>
                  <TBODY>
                    <TR>
                      <TH width="50" class=gridViewHeader style="WIDTH: 50px" scope=col>&nbsp;</TH>
                      <TH width="106" class=gridViewHeader scope=col>分 类 Id</TH>
                      <TH width="165" class=gridViewHeader scope=col>分 类 名 称</TH>
                      <TH width="494" class=gridViewHeader scope=col>分 类 备 注</TH>
                      <TH width="125" class=gridviewHeader scope=col>更新</TH>
                      <TH width="213" class=gridviewHeader scope=col>删除</TH>
                    </TR>
                   <%manageclass.select(Page_ID);%>
      <TR>
                      <TD colspan="6" class=gridViewItemF > <div class="yahoo2"> 
        <span class="disabled">< Prev</span>
    <span class="current">1</span>
    <a href="#?page=2" _fcksavedurl="#?page=2">2</a>
    <a href="#?page=3" _fcksavedurl="#?page=3">3</a>
    <a href="#?page=4" _fcksavedurl="#?page=4">4</a>
    <a href="#?page=5" _fcksavedurl="#?page=5">5</a>
    <a href="#?page=6" _fcksavedurl="#?page=6">6</a>
    <a href="#?page=7" _fcksavedurl="#?page=7">7</a>
    ...
    <a href="#?page=199" _fcksavedurl="#?page=199">199</a>
    <a href="#?page=200" _fcksavedurl="#?page=200">200</a>
    <a href="#?page=2" _fcksavedurl="#?page=2">Next ></a>
    </div> </TD>
                    </TR>
                  </TBODY>
                </TABLE>
            </td>
          </tr>
          <tr>
            <td height="20" colspan="5"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                <tr>
                  <td></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td width="2%" colspan="2"><span class="left_txt"><img src="images/icon-mail2.gif" width="16" height="11"> 客户服务邮箱:[email protected]<br>
                  <img src="images/icon-phone.gif" width="17" height="14"> 官方网站:http://www.bb.cq.cn</span></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td>
        <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
      </tr>
    </table>
    </body>
      

  2.   

    我猜想——页面tr td顺序与位置有问题
    仅供参考~
      

  3.   

    已经自己解决了用Vector变量返回集合