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

📄 selectpollanswer.java

📁 一个关于商业的网站
💻 JAVA
字号:
package com.everstar.poll;

/**
 * Title:        webstar
 * Description:  this is the webstar project
 * $ Modified Record:
 * $2003.4.6: Created.
 * Copyright (C) 2003 www.studyjava.com All rights reserved.
 * @version 1.0
 */
import java.util.*;
import java.sql.*;
import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;
import com.everstar.database.*;

public class SelectPollAnswer {
  private Database dbConn = null;  //database connection
  private String error = null;
  private int pollId = 0;
  private Vector bcBeans = new Vector();

  public Database getDbConn() { return(dbConn); }
  public void   setDbConn(Database newDbConn) { dbConn = newDbConn; }

  public void setError(String newError) { error = newError;}
  public String getError() { return error;}

  public void setPollId(int newPollId) { pollId = newPollId;}
  public int getPollId() { return pollId;}

  public void init() throws ServletException {
    if (dbConn == null)  error = "No Database connection";
    if (pollId <= 0) error = "No Poll Id";
    try{
      String  sql = "select  * from  themeopinion where themeNo = " + pollId;
      ResultSet rs = dbConn.select(sql);
      bcBeans.clear() ;
      while(rs.next()){
        PollAnswer  bcBean= new PollAnswer();
        bcBean.setThemeNO(rs.getInt("themeNo")) ;
        bcBean.setAnswerNo(rs.getInt("opinNo")) ;
        bcBean.setAnswerText(rs.getString("opinText"));
        bcBean.setAnswerCount(rs.getInt("selectCount"));
        bcBeans.add(bcBean);
      }
        rs.close();
        dbConn.close();
    }catch (Exception e){
      error = "SQL Error";
     }
  }

  public int getNumOfPollAnswer(){ return(bcBeans.size()); }

  public PollAnswer getPollAnswer(int idx) {
    return((PollAnswer)bcBeans.elementAt(idx));
  }

  public SelectPollAnswer() {
  }
}

⌨️ 快捷键说明

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