Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:大家帮忙看看这个错误!!! [Re:dwju]
dwju





发贴: 117
积分: 10
于 2003-08-02 16:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这里只是一个JSP页面,调用了一个JavaBean,
<%@ page contentType="text/html; charset=GBK"
import="java.sql.*"
%>

<%
String theType = request.getParameter("setType");
String theStr = "产品展示";
if(theType.equals("zzcp")) theStr="最新产品";
if(theType.equals("cxcp")) theStr="促销产品";
if(theType.equals("rxcp")) theStr="热销产品";
%>
<jsp:useBean id="bean" scope="page" class="wlsd.DBConnection"/>
<%
int rowCount;
int intPage = 1;
int pageCount =1;
if(bean.dbConnection())
{
  /********************************************************
  *这里根据前面传来不同的值,来判断SQL语句
  *然后再执行查询,计算总行数和总的页数
  ********************************************************/
  String query = "select * from kc_spzl";
  ResultSet resultset = bean.executeQuery(query);

  resultset.last();
  rowCount = resultset.getRow();
  intPage = 1;
  //转化接收到的页面信息
  String strPage = request.getParameter("page");
  if(strPage==null)
  {
    intPage=1;
  }
  else
  {
    intPage = java.lang.Integer.parseInt(strPage);
    if(intPage<1) intPage=1;
  }

  int pageSize = 12;

  pageCount = 0;
  pageCount = rowCount / pageSize;

  if(intPage>pageCount) intPage=pageCount;
  int j=(intPage-1)*pageSize+1;
  
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="stylesheet" href="css\css.css" type="text/css">
  </head>

  <body bgcolor="#FFFFFF" text="#000000" scroll=no>
    <table width=620 border="0" cellspacing="0" cellpadding="0" bgcolor="#E1E1E1" class="frmBox" align="center">
      <tr>
      <td bgcolor="#003399" height="20"></td>
      </tr>
      <tr>
      <td bgcolor="#999999" align=center>
        <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr>
        <td rowspan="2" align="center" width="16%"><img src="file:///F|/Information/Information/img/001.gif" width="32" height="32"></td>
        <td width="84%"><font color="#FFFFFF" size="+1"><b>产品展示</b></font></td>
        </tr>
        <tr>
        <td width="84%"><font color="#FFFFFF">-------<%out.println(theStr);%>

        </font></td>
        </tr>
        </table>
      </td>
      </tr>
      <tr bgcolor="#E1E1E1" height=20><td></td></tr>
      <tr><td align="center">
      <table width=615>
        <tr>
      <td align="left"> </td>
        </tr>
      </table>

<table width=615 border="0" cellspacing="1" cellpadding="0" style="border:2 inset;line-height:3.0" bgcolor="#CCCCCC" >
   <tr bgcolor="#E1E1E1">
       <td width=10% class="ed_btnStyle"><Strong>药品编号</strong></td>
       <td width=25% class="ed_btnStyle"><Strong>药品名称</strong></td>
       <td width=10% class="ed_btnStyle"><Strong>商品型号</strong></td>
       <td width=15% class="ed_btnStyle"><Strong>商品规格</strong></td>
       <td width=20% class="ed_btnStyle"><Strong>零售单价</strong></td>
       <td width=20% class="ed_btnStyle"><Strong>详细信息</strong></td>
      </tr>
<%
/***********************************************************
*利用前面求出的pageCount来为查询叶面分页
* 注意,后面翻页的时候,注意传递不同的查询类型值
***********************************************************/
  int i=0;
  resultset.absolute(j);
  while(i<pageSize && !resultset.isAfterLast())
  {
%>
<tr bgcolor="#FFFFFF">
<td width=5%><%=resultset.getString("spbm")%></td>
<td width=30%><%=resultset.getString("spmc")%></td>
<td width=10%><%=resultset.getString("spxh")%></td>
<td width=15%><%=resultset.getString("jjsx")%></td>
<td width=20%><%=resultset.getString("lsdj")%></td>
<td width=20% align="center"><a href="list.jsp">商品详细信息</a> </td>
</tr>
<%
    resultset.next();
    i=i+1;
  }
}
%>

这里是大概的代码,请看什么地方有错误,
<%=resultset.getString("lsdj")%>

这句去掉就可以,不去掉就不行




话题树型展开
人气 标题 作者 字数 发贴时间
11651 大家帮忙看看这个错误!!!(使用ResultSet对象的getString 错误:无效的描述符索引) dwju 7749 2003-08-02 15:48
10037 Re:大家帮忙看看这个错误!!! nothing 9 2003-08-02 15:58
9987 Re:大家帮忙看看这个错误!!! nothing 66 2003-08-02 17:58
9871 Re:大家帮忙看看这个错误!!! dwju 85 2003-08-04 17:57
9335 Re:大家帮忙看看这个错误!!!(使用ResultSet对象的getString 错误:无效的描述符索引) floater 37 2003-08-05 01:46
10057 Re:大家帮忙看看这个错误!!!(使用ResultSet对象的getString 错误:无效的描述符索引) nothing 96 2003-08-05 07:37
9630 Re:大家帮忙看看这个错误!!!(使用ResultSet对象的getString 错误:无效的描述符索引) runaway 100 2003-08-05 15:05
9907 Re:大家帮忙看看这个错误!!! dwju 3635 2003-08-02 16:13
9764 Re:大家帮忙看看这个错误!!! dwju 18 2003-08-04 07:57
9252 Re:大家帮忙看看这个错误!!! floater 100 2003-08-04 08:08
9864 Re:大家帮忙看看这个错误!!! dwju 36 2003-08-04 09:37
9386 Re:大家帮忙看看这个错误!!! floater 602 2003-08-04 09:58
9795 Re:大家帮忙看看这个错误!!! dwju 8 2003-08-04 10:03
9501 Re:大家帮忙看看这个错误!!! runaway 42 2003-08-04 13:19
9678 Re:大家帮忙看看这个错误!!! dwju 93 2003-08-04 17:29
9440 Re:大家帮忙看看这个错误!!! luoq_dl 63 2003-08-04 17:34
9790 Re:大家帮忙看看这个错误!!! dwju 94 2003-08-04 17:55

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923