edit1.jsp
上传用户:apbaoyuan
上传日期:2021-02-12
资源大小:1015k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

HTML/CSS

  1. <%@page import="java.sql.*"%>
  2. <%@page import="java.util.*"%>
  3. <%@page contentType="text/html;charset=GB2312"%>
  4. <%@include file="opendata.jsp"%>
  5. <%@include file="convert.jsp"%>
  6. <%@include file="check.jsp"%>
  7. <html>
  8. <head>
  9. <title>
  10. 编辑问题及选项
  11. </title>
  12. <link href="style.css" rel=stylesheet>
  13. <body>
  14. <center>
  15. 为了保证投票的公正性,请先将计数器清零后修改选项!
  16. </center>
  17. <hr>
  18. <form action=modify.jsp method=post>
  19. <DIV align=center>
  20.  <TABLE cellSpacing=0 cellPadding=0 width=73% align=center border=0 bordercolor="#999999">
  21.   <tr>
  22.    <td bgcolor=#999999>调查主题:</td>
  23. <%
  24. try{
  25.   request.setCharacterEncoding("GB2312");
  26.  request.getSession(true);
  27.  session.putValue("questionid",String.valueOf(request.getParameter("questionid")));
  28.  int questionid;
  29.  questionid = Integer.parseInt(request.getParameter("questionid"));
  30.  out.print("<a href=resetcount.jsp?questionid="+questionid+"><font color=red>将本主题投票记数全部清0</font></a>");
  31.  sql = "select Question from Questions where QuestionID='"+questionid+"'";
  32.  rs = smt.executeQuery(sql);
  33.  String question = null;
  34.  while(rs.next())
  35.  {
  36.    question = rs.getString(1);
  37.  // question = Replace(question);
  38.  }
  39.  %>
  40.  <td align=right><input class=smallInput type=text size=90 name=question value = "<%=question%>"></td>
  41.  <%sql = "select Item from Items where QuestionID='"+questionid+"'";
  42.  rs = smt.executeQuery(sql);
  43.  String item = null;
  44.  int i= 0;
  45.  while(rs.next())
  46.  {
  47.    item = rs.getString(1);
  48.    i++;
  49.    out.print("<tr><td>选项"+i+":</td>");
  50.  %>
  51.    <td align=right><input class=smallInput type=text size=90 name=item<%=String.valueOf(i)%> value="<%=item%>"></td></tr>
  52.  <%}
  53.  rs.close();
  54.  smt.close();
  55.  con.close();
  56.  for(;i<10;++i)
  57.  {
  58.     out.print("<tr><td>选项"+(i+1)+":</td>");
  59.     out.print("<td align=right><input class=smallInput type=text size=90  name=item"+String.valueOf(i+1)+" ></td></tr>");   
  60.  }
  61.  
  62.  }
  63.  catch (Exception e) {
  64. e.getStackTrace();
  65. }
  66. %>
  67.   <tr><td>
  68.   </tr>
  69. </table>
  70. </DIV>
  71. <p>
  72. <DIV align=center><INPUT class=buttonface type=submit value=发布 name=Submit>
  73. <INPUT class=buttonface type=reset value=重写 name=Submit2></DIV>
  74. </form>
  75. <hr>
  76. <div align="center"><a href = mainform.jsp>回问卷管理页面</a></div>
  77. </body>
  78. </html>