questiondetails.jsp
资源名称:examasp.rar [点击查看]
上传用户:hjt198082
上传日期:2015-04-16
资源大小:95k
文件大小:2k
源码类别:
MySQL数据库
开发平台:
Java
- <%@ page contentType="text/html;charset=GBK" %>
- <%@ page language="java" import="java.sql.*"%>
- <%@ page import="java.lang.Math.*" %>
- <jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>
- <%@ include file="/public/checkvalidadmin.jsp"%>
- <%@ include file="/public/checkvalidadmin8.jsp"%>
- <%!
- String id = "";
- String sql = "";
- ResultSet rs = null;
- // 下面方法实现了回车换行符向HTML中<BR>标记的转换
- public StringBuffer myTranslate(StringBuffer sour) {
- for(int i=0; i<sour.length(); i++) {
- if(sour.substring(i,i+1).equals("n")) {
- sour.delete(i,i+1);
- sour.insert(i,"<br>");
- }
- }
- return sour;
- }
- %>
- <html>
- <head>
- <title>题目详细信息</title>
- <link rel="stylesheet" href="../public/style.css">
- </head>
- <%
- id = request.getParameter("id");
- sql="SELECT * from test_question_lib where questionid=" + id;
- try {
- rs = conn.executeQuery( sql );
- }catch(Exception ee) {
- out.println("访问数据库错误!");
- return;
- }
- if(!rs.next()) {
- out.println("错误的ID号");
- return;
- }else {
- %>
- <table width="100%" HEIGHT=100% border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
- <tr bgcolor="#FAD185">
- <td colspan=2 height=20 align=center><b>题目编号:<%=rs.getString("questionid")%></b></td>
- </tr>
- <tr>
- <td colspan=2 valign=top>
- <p>
- <%=rs.getString("qname")%>
- </tr>
- <tr>
- <td width=10%>选项A</td>
- <td><%=rs.getString("choice1")%></td>
- </tr>
- <tr>
- <td>选项B</td>
- <td><%=rs.getString("choice2")%></td>
- </tr>
- <tr>
- <td>选项C</td>
- <td><%=rs.getString("choice3")%></td>
- </tr>
- <tr>
- <td>选项D</td>
- <td><%=rs.getString("choice4")%></td>
- </tr>
- <tr>
- <td>答案</td>
- <td><%=rs.getString("answer")%></td>
- </tr>
- </table>
- <%
- }
- %>
- </ul>
- </html>