运行异常,求解。

zhao_1128 zhao_1128 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.zhao.*" %>
<jsp:useBean id="DbBean" scope="session" class="com.zhao.XO"/>
<%
try{
String sql;
sql = "SELECT count(*) as num FROM XO";
ResultSet rs = DbBean.executeQuery(sql);
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
</head>

<body>

<table width=400 border="1" cellspacing="1" align=center>
<!--DWLayoutTable-->
<tr bgcolor="#6681D9">
<td height=20 colspan=7>
<div align="center"><b><font color="#ffffff">表的增删改</font></b></div>
</td>
</tr>

<tr height="20">
<td width="87" height="28" bgcolor="#d9e0f9" align="center">姓名</td>
<td width="87" bgcolor="#d9e0f9" align="center">工资</td>
<td width="87" bgcolor="#d9e0f9" align="center">部门</td>
<td valign="top" bgcolor="#d9e0f9" align="center" colspan="4">操作</td>
</tr>
<%
int pagesize=8;
int pagecount=0;
int count=0;
int currentpage=0;
if (rs.next()) {
count = rs.getInt("num");
float f = (float) count / (float) pagesize;
int pages = (int) (count / pagesize);
if (f > pages) pages++;
pagecount = pages ;
}
if(request.getParameter("page")!=null){//假如接收的页面数不为空
currentpage = java.lang.Integer.parseInt(request.getParameter("page"));//就把接收的页面数pagg赋值给gopage
}else{//否则
currentpage=1;//gopage为1,即显示第一页
}

//分页查询

sql = "select * from XO where id between 1 and 160";
// System.out.println(sql);
rs = DbBean.executeQuery(sql);
while(rs.next()){
String id=rs.getString("id");
String xm2=rs.getString("xm");
String gz=rs.getString("gz");
String bm=rs.getString("bm");
%>
<tr>
<td height="20" align="center"><%=xm2 %></td>
<td align="center"><%=gz %></td>
<td align="center"><%=bm %></td>
<td width="53" align="center"><a href="edit.jsp?id=<%=id %>">修改</a></td>
<td align="center" colspan="3"><a href="del.jsp?id=<%=id %>">删除</a></td>
</tr>
<%}
rs.close();
%>
<tr>
<td valign="middle" height="28" align="right" colspan="7"><a href="add.jsp">新增</a></td>

</tr>


</table>
<form action="index.jsp" method="post"><br><br></form>


<table width="300" height="22" border="1" align="center" cellspacing="1" >
<!--DWLayoutTable-->



<%}catch(Exception e){
out.print("<center>DbBean.executeQuery(sql)</center>");
}
%>

</table>
</body>

</html>



运行结果:
aq.executeQuery: The url cannot be null
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
zhao_1128
Web 开发 81,107 成员 341,720 内容