请问jsp连接数据库问题

lola 2003-07-18 09:45:06
我在menu.jsp里面,通过 parent.data.location.href = "data.jsp?id=" id;来连接data.jsp显示数据页面
在data.jsp里通过
<jsp:useBean id="testdb" scope="page" class="dbuser.dbmgr"/>

<%
String id=request.getParameter("id");

try{
testdb.connect();
String s = "select * from budget where budget_code like '" + id + "%' order by budget_code";
testdb.query(s);
%>
<table width="100%" height="18" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<%
while(testdb.next())
{
%>
<tr align="center" bgcolor="#C8E2FF">
<%
for(int j = 1;j<7;j++)
{%>
<td width="160" height="18"><font size="2"><%=testdb.getString(j)%></font></td>
<%}%>
</tr>
<%}%>
</table>
<%
testdb.close();
}
catch(Exception e)
{
out.println(e);
}
%>
来显示数据.为什么没有结果显示呢
...全文
18 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
breeze517 2003-07-18
  • 打赏
  • 举报
回复
parent.data.location.href = "data.jsp?id=" id
应该为这样吧
parent.data.location.href = "data.jsp?id="+<%=id%>

81,091

社区成员

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

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