希望斑竹帮助解答!!在线等待

smile_apple 2002-05-21 12:10:35
如何在不递交页面的情况下:

在jsp中实现 将页面的一个input值传递给java中的变量?

<% String num=null;%>

<input type="text" value="" name="r1">

需要根据r1的值从数据库中取出相关的其他数据

<% sql="select a1,a2 from t1 where con1="+<%=num%>;%>
...全文
18 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Andrawu 2002-05-21
  • 打赏
  • 举报
回复
不提交页面?有谁会啊,说说看!
sunharck 2002-05-21
  • 打赏
  • 举报
回复
public int getRowCount(ResultSet rs)
{
int iRowCnt=0;
try{
rs.last();
iRowCnt=rs.getRow();
//游标回到结果集的初试位置
rs.beforeFirst();
}catch(Exception _ex)
{System.out.println("计算记录的数量时出现如下错误:"+_ex);}
return iRowCnt;
}
sunharck 2002-05-21
  • 打赏
  • 举报
回复
sql=select colname from tablename;
rset=stmt.executeQuery(sql)
rset.last();
RowCnt=rset.getRow();
bbshero 2002-05-21
  • 打赏
  • 举报
回复
1. <input type="text" value="" name="r1" value= <%=num%>>
2. sql = "select count(8) from table '
long count = rs.getlLong("#1");
smile_apple 2002-05-21
  • 打赏
  • 举报
回复
还有一个问题:在java 中如何获得 resultset中的记录个数

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧