showvote.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@ page import="java.sql.*"%>
  3. <%@ page import="javax.sql.*"%>
  4. <%
  5.   try{
  6.   //数据库连接
  7.   Class.forName("oracle.jdbc.driver.OracleDriver");
  8.   String strUrl = "jdbc:oracle:thin:@slight:1521:LOCAL";
  9.   String strUser = "eshop";
  10.   String strPassword = "eshop";
  11.   Connection con = DriverManager.getConnection(strUrl, strUser, strPassword);
  12.   Statement st = con.createStatement();
  13.   String sql = "select * from type";
  14.   ResultSet rs = st.executeQuery(sql);
  15. %>
  16. <html>
  17. <head>
  18. <title>
  19. showvote
  20. </title>
  21. </head>
  22. <body bgcolor="#ffffff">
  23. <table width="100%" border="0" cellspacing="1" cellpadding="2">
  24.         <tr>
  25.           <td class="text1">
  26.             <p align="left">
  27. <%
  28.   if (rs.next()) out.println(rs.getString("type"));
  29. %>
  30. </td>
  31.         </tr>
  32.         <tr>
  33. <%
  34.   rs.close();
  35.   sql = "select id,note from vote order by id";
  36.   rs = st.executeQuery(sql);
  37. %>
  38. <td class="text1">
  39. <form method="post" action="vote.jsp" target="_Blank">
  40. <p align="center" style="word-spacing: 0; margin-top: 0; margin-bottom: 0">
  41.  <%    while (rs.next()){
  42. %>
  43.  <input type="radio" name="rb" value="<%=rs.getLong("id")%>">
  44.                 <%=rs.getString("note")%> </p>
  45.               <p align="center" style="word-spacing: 0; margin-top: 0; margin-bottom: 0">
  46.                 <%     }
  47.   %>
  48.   <br>
  49.                 <input type="submit" name="submit" value="提交" style=" BACKGROUND-COLOR: #cccccc" disabled>
  50. <input type="button" onClick="window.open('admin/votedetail.jsp')" value="查看" style=" BACKGROUND-COLOR: #cccccc" disabled>
  51.                 </p>
  52.             </form>
  53.           </td>
  54.  </tr>
  55.       </table>
  56. </body>
  57. </html>
  58. <%
  59.   }catch(Exception e){
  60.     e.printStackTrace();
  61.   }
  62. %>