cant't read datas from database
hi
when I try to read data form database ,it is show wrong message :
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:65
62: </tr>
63: <%
64: String sql="select * from ÃÃó";
65: ResultSet rs=odbc.executeQuery(sql);
66: while(rs.next()){
67: %>
68: <tr bgcolor="#D1EBF1">
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
the code is:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" 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>
<script language="javascript">
function re(){
form1.action="reg.jsp";
form1.method="get";
form1.submit();
}
function login(){
form1.action="loginServlet";
form1.method="post";
form1.submit();
}
</script>
<link rel="stylesheet" type="text/css" href="css/css.css">
</head>
<body>
<jsp:useBean id="odbc" scope="page" class="my.data.MyOdbc"/>
<%
String userName;
if(session.getAttribute("userId")==null){
session.setAttribute("Type","guest");
userName="ÃÿÃ";
}else{
userName=(String)session.getAttribute("userId");
}
%>
<form action="loginServlet" method="post" name="form1" >
<table width="800" align="center">
<tr>
<th width="573" height="24" background="pic/table.gif" scope="col">
<div align="left">Ãû§Ãû:
<input name="userId" type="text" id="userId" size="13">
ÃÃÃë:
<input name="password" type="password" id="password" size="13">
<input type="Submit" name="Submit" value="µÃü" onClick="login();";>
<input type="Submit" name="Submit2" value="â²á" onClick="re();">
</div></th>
<th width="101" background="pic/table.gif" scope="col"><%if(!userName.equals("ÃÿÃ")){%>< a href="admin_login.jsp" >¡¾¹ÃÃá¿</a>
<%}%></th>
<th width="110" background="pic/table.gif" scope="col"><a href="loginout.jsp" >¡¾ÃóöµÃü¡¿</a></th>
</tr>
</table>
</form>
<p> </p>
<table width="800" border="0" align="center">
<tr >
<th height="24" colspan="5" background="pic/table.gif" scope="col"><marquee><%=userName%>ÃãºÃ£¡£¡ »¶ÃÂôxxÃÃ󣡣¡<img src="pic/oicq.gif" width="16" height="16">ÃãµÃIPµÃ÷ÃÃ:<%=request.getR emoteAddr()%></marquee></th>
</tr>
<tr bgcolor="#EAF8FB">
<th width="94" height="25" scope="col"> ÃÃóÃñÃ</th>
<th width="167" scope="col"> ÃùÃÃÃýÿ </th>
<th width="167" scope="col"> Ãîºó·¢±à </th>
<th width="170" scope="col"> °æÃ÷ </th>
</tr>
<%
String sql="select * from ÃÃó";
ResultSet rs=odbc.executeQuery(sql);
while(rs.next()){
%>
<tr bgcolor="#D1EBF1">
<td height="38" width="94"><a href="board.jsp?boardId=<%=rs.getString("ÃÃóI d")%>&board=<%=rs.getString("ÃÃóÃû³Ã")%>" > <%=rs.getString("ÃÃóÃû³Ã")%> </a> <br />
</td>
<td width="167" height="38" align="center"><%=rs.getString("ÃùÃÃÃýÿ") %></td>
<td width="167" height="38">ñ¼ä£º<%=rs.getString("Ãîºó ·Â¢Â±Ãñ¼ä")%><br>
Ã÷Ããº<%=rs.getString("Ãîºó·¢±ÃÃÃ" )%></td>
<td width="170" height="38" align="center"><%=rs.getString("°æÃ÷ÃÃÃû") %></td>
</tr>
<%
}
odbc.closeConn();
%>
</table>
<jsp:include page="inc/conut.jsp" flush="true"/>
<table width="800" border="0" align="center">
<tr>
<td height="24" background="pic/table.gif"> </td>
</tr>
</table>
<p><jsp:include page="copy.jsp" flush="true" /> </p>
</body>
</html>
and I use jdbo-odbc to connect the database .Every jsp pages want to read data from databae ,it is cant't success.
what can I do to make is wright??
thanks!
|