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

📄 thanks_jsp.java

📁 在线投票系统,利用JSP技术来开发,方便大家使用
💻 JAVA
字号:
package org.apache.jsp;

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

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


 String convert(String str)
 {
  byte newstr[] = new byte[str.length()];
  for(int i=0;i<str.length();i++)
   newstr[i]=(byte)str.charAt(i);
  return new String(newstr);
 }
 String Replace(String str)
 {
  int index=0;
  while((index=str.indexOf("\n")) != -1)
   str = str.substring(0,index) +"<br>"+ str.substring(index+1);
  return(str);
 }

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/convert.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");
      out.write("\r\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');
      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");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<title>\r\n");
      out.write("感谢您的参与\r\n");
      out.write("</title>\r\n");
      out.write("<LINK href=\"style.css\" rel=stylesheet>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");

/*
  sql = "SELECT QuestionID from questions where IsVisable = 1 ";
  rs = smt.executeQuery(sql);
  String question = null,item = null,_sql;
  Statement _smt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
  ResultSet _rs;
  int questionid = 0,itemid = 0;
  while(rs.next())
  {
    questionid = rs.getInt(1);
    itemid = Integer.parseInt(request.getParameter(String.valueOf(questionid)));
    _sql = "update Items set ItemCount = ItemCount + 1  Where ItemID ="+itemid;
    _smt.executeUpdate(_sql);
  }
  */
  ResultSet rs=null;
  ResultSet ch_rs=null;
  String sqlstring  = "SELECT QuestionID from questions where IsVisable = 1 ";
try
  {
    rs=sqltest.executeQuery(sqlstring);
    int questionid = 0,itemid = 0;
   while(rs.next())
   {
     questionid = rs.getInt(1);
     itemid = Integer.parseInt(request.getParameter(String.valueOf(questionid)));
     sqlstring = "update Items set ItemCount = ItemCount + 1  Where ItemID ="+itemid;
     sqltest.executeUpdate(sqlstring);
   }
  }
catch(SQLException e1)
  {
    out.print("SQL异常!");
  }


      out.write("\r\n");
      out.write("<center>\r\n");
      out.write("感谢您的参与!<p>\r\n");
      out.write("<div align=\"center\"><a href=\"showresult.jsp\">查看投票结果</a></div>\r\n");
      out.write("<p>\r\n");
      out.write("<div align=\"center\"><a href=\"Javascript:window.close();\">关闭窗口</a></div>\r\n");
      out.write("</center>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</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 + -