⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainform_jsp.java

📁 一个很好的在线投票系统
💻 JAVA
字号:
package org.apache.jsp.admin;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

public final class mainform_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

 String modifyid ;
  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/admin/check.jsp");
  }

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=GB2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");

//ÑéÖ¤¹ÜÀíÔ±ÊÇ·ñÒѾ­µÇ½
  if((String)session.getValue("Enter")!="true")
   {
     String errmsg="error2";
     response.sendRedirect("login.jsp?errmsg="+errmsg);
   }

      out.write('\r');
      out.write('\n');
      database.opendata sqltest = null;
      synchronized (_jspx_page_context) {
        sqltest = (database.opendata) _jspx_page_context.getAttribute("sqltest", PageContext.PAGE_SCOPE);
        if (sqltest == null){
          sqltest = new database.opendata();
          _jspx_page_context.setAttribute("sqltest", sqltest, PageContext.PAGE_SCOPE);
          out.write('\r');
          out.write('\n');
        }
      }
      out.write("\r\n\r\n<html>\r\n<head>\r\n<title>问卷管理</title>\r\n<LINK href=\"style.css\" rel=stylesheet>\r\n</head>\r\n<body>\r\n<div align=center><font color=red>管理员可以发布新问题,撤消正在发布的主题,修改、删除已经被撤消的主题。</red></div>\r\n");
      out.write("\r\n<TABLE bgcolor=#999999 cellSpacing=0 cellPadding=0 width=100% border=1>\r\n  <TBODY>\r\n  <TR bgColor=#999999>\r\n    <TD colSpan=2>\r\n          <DIV align=center>正在被投票的主题</DIV>\r\n    </TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colSpan=2>\r\n      <TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=1 bgcolor=\"#999999\">\r\n        <TBODY>\r\n            <TR>\r\n              <TD width=\"18%\">\r\n                <div align=\"center\">发布时间</div>\r\n              </TD>\r\n              <TD width=\"55%\" >\r\n                <div align=\"center\">主题</div>\r\n              </TD>\r\n              <TD width=\"13%\">\r\n                <div align=\"center\">撤消|恢复</div>\r\n              </TD>\r\n              <TD width=\"14%\">\r\n                <div align=\"center\">是否公布结果</div>\r\n              </TD>\r\n            </TR>\r\n\r\n");

 ResultSet rs=null;
 String sqlstring = "select * from questions where IsVisable=1";
 rs = sqltest.executeQuery(sqlstring);
 String question,date;
 int isvisable;
 int questionid ;
 int id = 0;
 int isopen = 0;
 while(rs.next())
 {
  questionid = rs.getInt(1);
  question = rs.getString(2);
  isvisable = rs.getInt(3);
  date = rs.getString(4);
  isopen = rs.getInt(5);
  out.print("<tr>");
  out.print("<td align=center>"+date+"</td>");
  out.print("<td ><a href=result.jsp?questionid="+questionid+" target = _blank>"+question+"</a></td>");
  out.print("<td align=center><a href=isvisable.jsp?questionid="+questionid+">撤消</a></td>");
  if (isopen == 1)
	  out.print("<td align=center><a href=isopen.jsp?questionid="+questionid+">隐藏结果</a></td>");
  else
	  out.print("<td align=center><a href=isopen.jsp?questionid="+questionid+">公布结果</a></td>");
  out.print("</tr>");
 }


      out.write("\r\n        </TBODY>\r\n      </TABLE>\r\n    </TD>\r\n  </TR>\r\n</table>\r\n\r\n<p>\r\n<p>\r\n<hr>\r\n<div align=center><font color=red>管理员可以恢复已经撤销的主题,或者选择把它永久性删除。</red></div>\r\n<p>\r\n<p>\r\n<TABLE bgcolor=#999999 cellSpacing=0 cellPadding=0 width=100% border=1>\r\n  <TBODY>\r\n  <TR bgColor=#999999>\r\n    <TD colSpan=2>\r\n          <DIV align=center>已经撤消或者尚未发布的主题</DIV>\r\n    </TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colSpan=2>\r\n      <TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=1 bgcolor=\"#999999\">\r\n        <TBODY>\r\n            <TR>\r\n              <TD width=\"18%\">\r\n                <div align=\"center\">发布时间</div>\r\n              </TD>\r\n              <TD width=\"55%\">\r\n                <div align=\"center\">主题</div>\r\n              </TD>\r\n              <TD width=\"9%\">\r\n                <div align=\"center\">撤消|恢复</div>\r\n              </TD>\r\n              <TD width=\"9%\">\r\n                <div align=\"center\">永久删除 </div>\r\n              </TD>\r\n            </TR>\r\n\r\n");

 ResultSet rs1=null;
 sqlstring= "select * from questions where IsVisable=0";
 rs1 = sqltest.executeQuery(sqlstring);
 String _question,_date;
 int _questionid,_isvisable,_id=0;
 while(rs1.next())
 {
  _questionid = rs1.getInt(1);
  _question = rs1.getString(2);
  _isvisable = rs1.getInt(3);
  _date = rs1.getString(4);
  _id++;
  //_quetionid = String.valueOf(_questionid);
  out.print("<tr>");
  out.print("<td align=center>"+_date+"</td>");
  out.print("<td><a href=result.jsp?questionid="+_questionid+" target = _blank>"+_question+"</a></td>");
  out.print("<td align=center><a href=isvisable.jsp?questionid="+_questionid+">恢复</a></td>");
  out.print("<td align=center><a href=delete.jsp?questionid="+_questionid+">删除</a></td>");
  out.print("</tr>");
 }

      out.write("\r\n\r\n        </TBODY>\r\n      </TABLE>\r\n    </TD>\r\n  </TR>\r\n</table>\r\n\r\n<p>\r\n<p>\r\n<hr>\r\n<TD align=\"center\">\r\n   <div align=\"center\"><a href=showresult.jsp target = _blank>查看所有主题投票统计</a></div><p><hr>\r\n   <div align=\"center\"><a href=addpoll.jsp>发布新问题</a></div><p><hr>\r\n   <div align=\"center\"><a href=edituser.jsp>修改密码</a></div>\r\n\r\n</TD>\r\n\r\n</body>\r\n</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -