| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 615 人关注过本帖
标题:显示数据库中一个表该如何写代码??
取消只看楼主 加入收藏
lewis0323
Rank: 2
等 级:新手上路
威 望:3
帖 子:102
专家分:0
注 册:2006-7-20
收藏
 问题点数:0 回复次数:2 
显示数据库中一个表该如何写代码??

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.*;" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生管理系统</title>
</head>
<%! String url,sql;%>
<%! Connection conn;%>
<%! ResultSet rs;%>
<%! int i;%>
<body bgcolor="#FFFFFF">
<div align="center"><font color="#000000" size="+5">学生管理系统</font></div>
<table width="75%" border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<td width="16%" align=center>学号</td>
<td width="16%" align=center>姓名</td>
<td width="8%" align=center>性别</td>
<td width="8%" align=center>年龄</td>
<td width="16%" align=center>籍贯</td>
<td width="12%" align=center>院系</td>
<td width="12%" align=center>修改</td>
<td width="12%" align=center>删除</td>
</tr>
<%
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
url="jdbc:microsoft:sqlserver://localhost:1433;
DatabaseName=university";
conn=DriverManger.getConnection(url,"admin","123456");
stmt=conn.createStatement();
sql="select * from student";
rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<tr>
<td width="16%" align="center" <%=rs.getObject(1)%> </td>
<td width="16%" align="center" <%=rs.getObject(2)%> </td>
<td width="8%" align="center" <%=rs.getObject(3)%> </td>
<td width="8%" align="center" <%=rs.getObject(4)%> </td>
<td width="16%" align="center" <%=rs.getObject(5)%> </td>
<td width="12%" align="center" <%=rs.getObject(6)%> </td>
<td width=12% align=center><ahref="change.jsp?xuehao=<%=rs.Object(1)%>">修改</a></td>
<td width=12% align=center><ahref="del.jsp?xuehao=<%=rs.Object(1)%>">删除</a></td>
</tr>
<%
}
rs.close();
stmt.close();
conn.close();
}catch(Exception e){
out.println(e);}
%>


</table>
<div align="center"><a href="insert.jsp">添加新记录</a></div>
</body>
</html>



An error occurred at line: 25 in the jsp file: /list.jsp
Generated servlet error:
String literal is not properly closed by a double-quote


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 25 in the jsp file: /list.jsp
Generated servlet error:
String literal is not properly closed by a double-quote


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

搜索更多相关主题的帖子: 数据库 java dtd loose 
2006-10-12 17:03
lewis0323
Rank: 2
等 级:新手上路
威 望:3
帖 子:102
专家分:0
注 册:2006-7-20
收藏
得分:0 
这里哪里错了啊   该怎么改???
2006-10-12 17:37
lewis0323
Rank: 2
等 级:新手上路
威 望:3
帖 子:102
专家分:0
注 册:2006-7-20
收藏
得分:0 
  这里漏了个  &gt;    可是加上还是不行啊  请问你们的JSP文件怎么调试啊
2006-10-12 17:40
快速回复:显示数据库中一个表该如何写代码??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029437 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved