日期:2014-05-18  浏览次数:20737 次

关于用jsp分列循环显示oracle数据库中记录的问题?
<%
    String   code=request.getParameter( "id ");
      if(code==null){
      code= "0 ";
      }
  try
    {
ResultSet   rst=dbconn.executeQuery( "select   CORP_NAME   from   T_B_CORP   where   SUP_CORP_CODE= ' "+code+ " '   and   IS_USE= '1 ' ");
  if(rst==null){
    out.println( "暂时没有单位! ");
    }else{
      while(rst.next())
    {
    %>
    <table   width= "100% ">
    <tr>
    <td> <%=rst.getString( "CORP_NAME ")%> </td>
    <tr>
    </table>
    <%
  }
    rst.close();
        }
}
        catch(Exception   e)
        {
        e.printStackTrace();
        }
%>
我想分4列循环显示该表中的该字段的记录,该怎样做列?

------解决方案--------------------

while(rst.next())
{
%>
<table width= "100% ">
<tr>
<td> <%=rst.getString( "CORP_NAME ")%> </td>
<tr>
</table>
<%
}

改成:
<table width= "100% ">
<%
while(rst.next())
{
%>
<tr>
<td> <%=rst.getString( "CORP_NAME ")%> </td>
<tr>
<%
}
%>
</table>