ShowQuest.jsp
资源名称:0102010.rar [点击查看]
上传用户:nbluoke
上传日期:2013-08-09
资源大小:4851k
文件大小:2k
源码类别:
教育系统应用
开发平台:
WORD
- <%@ page contentType="text/html; charset=gb2312" language="java" %>
- <%@ page import="java.sql.*" %>
- <%@ page import="jinghua.*"%>
- <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
- </jsp:useBean>
- <%!String strQuest1,strTip,strQuest2=null;%>
- <%!Connection Conn;%>
- <%
- String DBID="";
- int dbid=-1;
- if(!(session.isNew())){
- DBID=request.getParameter("dbid");
- if(DBID==null){
- DBID="";
- }
- DBID=jinghua.Tools.codestring(DBID);
- }
- if(!(DBID.equals("")))
- {
- dbid=Integer.parseInt(DBID);
- Connection Conn=DBCon.getConnection();
- Statement stmt = Conn.createStatement();
- ResultSet rs;
- String strHtml=null;
- String sql;
- try{
- strQuest1=null;
- sql="select ID,QuestText,Tip from question where id="+dbid;
- rs=stmt.executeQuery(sql);
- if(rs.next()){
- strQuest1=rs.getString("QuestText");
- strTip=rs.getString("Tip");
- }
- }catch (SQLException e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
- %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>无标题文档</title>
- </head>
- <body>
- <table width="84%" border="1" align="center">
- <tr>
- <td colspan="3" align="center">Question数据库查询</td>
- </tr>
- <tr align="left">
- <td width="24%" rowspan="2"><form name="form1" method="post" action="ShowQuest.jsp">
- <table width="64%" height="78" border="0">
- <tr>
- <td><input name="dbid" type="text" id="dbid" size="10"></td>
- </tr>
- <tr>
- <td><input type="submit" name="Submit" value="提交"></td>
- </tr>
- </table>
- <font size="-1"><font size="-3"></font></font> </form></td>
- <td height="208" colspan="2"> <%if(strQuest1==null) out.print("<BR>"); else out.print(strQuest1);%> </td>
- <td width="3%" rowspan="2"></td>
- </tr>
- <tr align="left">
- <% if(strQuest1!=null)
- strQuest1=jinghua.Tools.toHtml(strQuest1);%>
- <td width="26%" height="200"><%if (strQuest1==null) out.print("<BR>"); else out.print(strQuest1);%> </td>
- <td width="47%" height="200"><%if (strTip==null) out.print("<BR>"); else out.print(strTip);%> </td>
- </tr>
- </table>
- </body>
- </html>