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

📄 pollinformation.jsp

📁 一个关于商业的网站
💻 JSP
字号:
<%
/*
 *	pollInformation.jsp Load poll information from database.
 *	Written by Jack April 16th,2001
 *      All rights reserved by EVERSTAR COMPANY. 2001-2002.
 *  Notes:
 *       refered tables: THEMEINFO、THEMEOPINION
 *                model:   OnlinePoll
 *  Modified Records:
 *       $2001.04.16 Created.
 */
%>
<%@  page import="java.util.*,
                  java.sql.*,
                  java.lang.*,
                  java.* ,
                  javax.servlet.http.*,
                  com.everstar.util.*"          
%>
<jsp:useBean id="dbConn" scope="request" class="com.everstar.database.Database"/>
<jsp:include page="../header.jsp" flush="true"/>
<%  
  int themeNo = 1; 
  String showThemeNo = ""; 
  String tempStr1 = "";
  String tempStr2 = "";
  String outputStr = "nothing";
  ResultSet  rs = null; 
  String    sqlStr = "select THEMENO,THEMETITLE,THEMEDETAIL from THEMEINFO where STATUS=1";    
  if (dbConn.count(sqlStr)==0)
  {
   response.sendRedirect("../Error.jsp?message=POLL_ERROR_NOPOLL");  
  }
  else  
  try
  {
   rs = dbConn.select(sqlStr);  
   if(rs.next())
         {
          themeNo = rs.getInt(1); 
          tempStr1 = rs.getString(2);
         tempStr2 =  rs.getString(3);
         }
   rs.close();
   dbConn.close();      
  }
  catch(SQLException ex)
  {
    response.sendRedirect("../Error.jsp?message=POLL_ERROR_NOPOLL");
   
  }
%>



<script language=javascript>
function sumCount()
{
  document.showForm.answerCount.value=document.showForm.answerGroup.length;
  document.showForm.answer1Count.value="uncheck";
  document.showForm.answer2Count.value="uncheck";
  document.showForm.answer3Count.value="uncheck";
  document.showForm.answer4Count.value="uncheck";   
 if (document.showForm.answerGroup[0].checked==true) 
 {
      document.showForm.answer1Count.value="check";
 }
 if (document.showForm.answerGroup[1].checked==true) 
 {
      document.showForm.answer2Count.value="check";
 }
 if (document.showForm.answerGroup.length==4) 
 {   
   if (document.showForm.answerGroup[2].checked==true) 
     {
        document.showForm.answer3Count.value="check";
     }
   if (document.showForm.answerGroup[3].checked==true) 
     {
        document.showForm.answer4Count.value="check";
     }  
 }
 if (document.showForm.answerGroup.length==3) 
 {   
   if (document.showForm.answerGroup[2].checked==true) 
     {
        document.showForm.answer3Count.value="check";
     }   
 }
 if((document.showForm.answer1Count.value=="uncheck")&&(document.showForm.answer2Count.value=="uncheck")
   &&(document.showForm.answer3Count.value=="uncheck")&&(document.showForm.answer4Count.value=="uncheck"))
  {
   alert("Please select opinion!");
   return false;
  }
  return true;
}
</script>



<form method="POST" action="./pollResult.jsp" name="showForm" onsubmit="return sumCount()">
<table width ="100%" align =center>
<tr><td   ><FONT style="FONT-FAMILY: ; FONT-SIZE: 10pt"> <b><%=tempStr1%></b></font></td></tr></table>
<table width ="100%" align =center>
<tr><td ><%=tempStr2%></td></tr>
</table>
<hr>
<%
try{
 showThemeNo = "<input type=hidden name=themeNo value="+themeNo+">";
 String sql = "select OPINTEXT from THEMEOPINION where THEMENO="+themeNo;
 ResultSet rs2 = dbConn.select(sql);
 rs2.next(); 
 String tempOpinText; 
 tempOpinText = rs2.getString(1);
  outputStr = "<TR><td><input type=radio  name=answerGroup>"+tempOpinText+"</td></TR>";
 rs2.next(); 
 tempOpinText = rs2.getString(1);  
  outputStr+="<TR><td><input type=radio name=answerGroup>"+tempOpinText+"</td></TR>";
 if(rs2.next())
 {    
    tempOpinText=rs2.getString(1);
    outputStr+="<TR><td><input type=radio  name=answerGroup>"+tempOpinText+"</td></TR>";    
    if(rs2.next())
    {     
     tempOpinText=rs2.getString(1);
     outputStr+="<TR><td><input type=radio  name=answerGroup>"+tempOpinText+"</td></TR>";
    }
 }
   rs2.close();
   dbConn.close(); 
}
catch(SQLException ex){
 response.sendRedirect("../Error.jsp?message=POLL_ERROR_NOPOLL"); 
}
%> 
<TABLE  width="100%" align=center border=0 >
  <%=outputStr%>
  <tr><td>  
   <input type="submit" value="Vote" name="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp; 
  <input type="button" value="Result" name="btnShowResult" onClick=window.open("showResult.jsp","result")> 
  </tr>
    </TABLE>
  <%=showThemeNo%>  
  <input type="hidden" name="answerCount" value=2>
  <input type="hidden" name="answer1Count" value=uncheck>
  <input type="hidden" name="answer2Count" value=uncheck>
  <input type="hidden" name="answer3Count" value=uncheck>
  <input type="hidden" name="answer4Count" value=uncheck>
  <input type="hidden" name="otherOpin" value=no>
</form> 
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> 

<jsp:include page="../footer.jsp" flush="true"/>

⌨️ 快捷键说明

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