questionsavemodify.jsp
资源名称:examasp.rar [点击查看]
上传用户:hjt198082
上传日期:2015-04-16
资源大小:95k
文件大小:3k
源码类别:
MySQL数据库
开发平台:
Java
- <%@page contentType="text/html;charset=GBK"%>
- <%@page import="java.sql.*" errorPage="/public/error.jsp"%>
- <%@ include file="/public/checkvalidadmin.jsp"%>
- <%@ include file="/public/checkvalidadmin8.jsp"%>
- <jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>
- <%!
- ResultSet rs = null;
- String questionid;
- String selectid;
- String classid;
- String qname;
- String choice1;
- String choice2;
- String choice3;
- String choice4;
- String answer;
- String sql = "";
- int result = 0;
- String currpage = "1";
- %>
- <%
- request.setCharacterEncoding("GBK");
- currpage = request.getParameter("Page");
- questionid = request.getParameter("questionid");
- selectid = request.getParameter("selectid");
- classid = request.getParameter("classid");
- qname = request.getParameter("qname");
- choice1 = request.getParameter("choice1");
- choice2 = request.getParameter("choice2");
- choice3 = request.getParameter("choice3");
- choice4 = request.getParameter("choice4");
- answer = request.getParameter("answer");
- // 避免用户直接在浏览器地址栏输入页面地址所产生的Exception
- if(questionid==null || questionid.equals("")) {
- out.println("<center>");
- out.println("请进行合法操作!");
- out.println("</center>");
- return;
- }
- try{
- sql = "select * from test_question_lib where ";
- sql += " questionid='" + questionid + "'";
- rs = conn.executeQuery( sql );
- if(!rs.next()) {
- out.println("<center>");
- out.println("数据库没有代号为" + questionid + "的试题信息!<br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- } else {
- sql = "update test_question_lib set selectid=" + selectid;
- sql+= ",classid='" + classid + "'";
- sql+= ",qname='" + qname + "'";
- sql+= ",choice1='" + choice1 + "'";
- sql+= ",choice2='" + choice2 + "'";
- sql+= ",choice3='" + choice3 + "'";
- sql+= ",choice4='" + choice4 + "'";
- sql+= ",answer='" + answer + "'";
- sql+= " where questionid='" + questionid + "'";
- result = conn.executeUpdate( sql );
- if(result !=1 ) {
- out.println("<center>");
- out.println("试题信息更新失败!<br><br>");
- out.println("请将下列信息告知管理员<br><br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- }
- }
- }catch(Exception ee) {
- out.println("<center>");
- out.println("试题信息更新失败!<br><br>");
- out.println("请将下列信息告知管理员<br><br>");
- out.println(ee.toString() + "<br><br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- }
- %>
- <jsp:forward page="questionmanager.jsp">
- <jsp:param name="Page" value="<%=currpage%>"/>
- </jsp:forward>
- </center>
- </Body>
- </html>