err_query_detail.jsp
上传用户:nbluoke
上传日期:2013-08-09
资源大小:4851k
文件大小:2k
源码类别:

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="jinghua.*"%>
  3. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  4. </jsp:useBean>
  5. <%!boolean debug=false;
  6. %>
  7. <%
  8. String id=request.getParameter("id");
  9. String sql;
  10. String questtext="";
  11. String tip="";
  12. String ans="";
  13. sql="SELECT   `question`.`QuestText`,  `question`.`Tip`,  `question`.`Answer`"+
  14.     " FROM  `question`WHERE  (`question`.`ID` ="+id+")";
  15. if(debug){
  16.     out.print("<br>sql="+sql);
  17. }
  18. try{
  19.     Connection con=DBCon.getConnection();
  20.     Statement stmt=con.createStatement();
  21.     ResultSet rs=stmt.executeQuery(sql);
  22.     if(rs.next()){
  23.         questtext=rs.getString("QuestText");
  24.         tip=rs.getString("Tip");
  25.         ans=rs.getString("Answer");
  26.     }
  27. }
  28. catch(SQLException se){
  29.     out.println(se.toString());
  30. }
  31. catch(Exception e){
  32.     out.print(e.toString());
  33. }
  34. finally{
  35.     DBCon.dropConnection();
  36. }
  37. %>
  38. <html>
  39. <head>
  40. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  41. <title>试题编号:<%=id%></title>
  42. <link rel="stylesheet" type="text/css" href="../css.css">
  43. </head>
  44. <body >
  45. <div align="center">
  46.   <table width="100%" height="87%" border="1" align="center" cellspacing="1" bordercolor="#799AE1" id="AutoNumber3" style="border-collapse: collapse">
  47.     <tr> 
  48.       <td height="41" nowrap>答案:<%=ans%></td>
  49.     </tr>
  50.     <tr>
  51.       <td height="300" valign="top">提示:<br> <p><%=tip%></p>
  52.        <p>&nbsp;</p>
  53.         <p>&nbsp;</p>
  54.         <p>&nbsp;</p>
  55.         <p>&nbsp;</p>
  56.         </td>
  57.     </tr>
  58.     <tr> 
  59.       <td height="25" valign="top"> <div align="center">
  60.           <input border="0" value="关 闭" name="I1" type="button" class="s02" onClick="window.close()">
  61.         </div></td>
  62.     </tr>
  63.   </table>
  64.   <p>&nbsp;</p>
  65.   <p align="left">&nbsp;</p>
  66.   <p align="left"><font color="#000000"> </font></p>
  67.   <p align="left">&nbsp; </p>
  68. </div>
  69. </body>
  70. </html>