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

📄 viewthread.jsp

📁 功能比较全的一个论坛
💻 JSP
📖 第 1 页 / 共 2 页
字号:
      // Recordset is empty
      out.println(sNoRecords);
    
      out.print("     <tr>\n      <td colspan=\"4\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
      out.print("<a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      out.println("</td>\n     </tr>");
    
      iCounter = RecordsPerPage+1;
      bIsScroll = false;
    }

    else {

  
    // Parse scroller
    boolean bInsert = false;
    boolean bNext = rs.next();
    if ( !bNext && iPage == 1 ) {
    
      out.print("     <tr>\n      <td colspan=\"2\" bgcolor=\"#f2f2f2\">\n       <font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
      out.print("\n        <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      out.println("\n      </td>\n     </tr>");
    
    }
    else {
      out.print("     <tr>\n      <td colspan=\"2\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
    
      out.print("\n       <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      bInsert = true;
    
      if ( iPage == 1 ) {
        out.print("\n       <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
      }
      else {
        out.print("\n       <a href=\""+sFileName+"?"+formParams+sSortParams+"Formmessage_Page="+(iPage - 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
      }
  
      out.print("\n       [ "+iPage+" ]");
  
      if (!bNext) { 
        out.print("\n       <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
      }
      else {
        out.print("\n       <a href=\""+sFileName+"?"+formParams+sSortParams+"Formmessage_Page="+(iPage + 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
      }
    
      if ( ! bInsert ) {
        out.print("     <tr>\n      <td colspan=\"4\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
        out.print("\n        <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      }
    
      out.println("</td>\n     </tr>");
    }
  
    }

    if ( rs != null ) rs.close();
    out.println("    </table>");
    
  }
  catch (Exception e) { out.println(e.toString()); }
}


  void replies_Show (javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String srepliesErr, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException  {
  
    String sWhere = "";
    int iCounter=0;
    int iPage = 0;
    boolean bIsScroll = true;
    boolean hasParam = false;
    String sOrder = "";
    String sSQL="";
    String transitParams = "";
    String sQueryString = "";
    String sPage = "";
    int RecordsPerPage = 20;
    String sSortParams = "";
    String formParams = "";

      String pmid="";


    formParams = "mid=" + toURL(getParam( request, "mid")) + "&"; 
    // Build WHERE statement
        
    //-- Check mid parameter and create a valid sql for where clause
  
    pmid = getParam( request, "mid");
    if ( ! isNumber (pmid)) {
      pmid = "";
    }
    
    if (pmid != null && ! pmid.equals("")) {
            
        hasParam = true;
        sWhere += "m.message_parent_id=" + pmid;
    }
    
    if (hasParam) { sWhere = " WHERE (" + sWhere + ")"; }
    // Build ORDER statement
    sOrder = " order by m.date_entered Desc";

  // Build full SQL statement
  
  sSQL = "select m.author as m_author, " +
    "m.date_entered as m_date_entered, " +
    "m.message as m_message, " +
    "m.message_parent_id as m_message_parent_id, " +
    "m.topic as m_topic " +
    " from messages m ";
  
  sSQL = sSQL + sWhere + sOrder;

  String sNoRecords = "     <tr>\n      <td colspan=\"2\" ><font face=\"arial\" size=\"2\">No records</font></td>\n     </tr>";


  String tableHeader = "";
    
  
  try {
    out.println("    <table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">");
    out.println("     <tr>\n      <td bgcolor=\"#c2c2c2\" colspan=\"2\"><a name=\"replies\"><font face=\"arial\" style=\"font:bold\" color=\"#0033cc\">回复文章</font></a></td>\n     </tr>");
    out.println(tableHeader);

  }
  catch (Exception e) {}

  
  try {
    // Select current page
    iPage = Integer.parseInt(getParam( request, "Formreplies_Page"));
  }
  catch (NumberFormatException e ) {
    iPage = 0;
  }

  if (iPage == 0) { iPage = 1; }
  RecordsPerPage = 20;
  try {
    java.sql.ResultSet rs = null;
    // Open recordset
    rs = openrs( stat, sSQL);
    iCounter = 0;
    absolute (rs, (iPage-1)*RecordsPerPage+1);
    java.util.Hashtable rsHash = new java.util.Hashtable();
    String[] aFields = getFieldsName( rs );

    // Show main table based on recordset
    while ( (iCounter < RecordsPerPage) && rs.next() ) {

      getRecordToHash( rs, rsHash, aFields );
      String fldauthor = (String) rsHash.get("m_author");
      String flddate_entered = (String) rsHash.get("m_date_entered");
      String fldmessage = (String) rsHash.get("m_message");
      String fldtopic = (String) rsHash.get("m_topic");
fldmessage = replace(fldmessage,CRLF,"<br>");

      out.print("     <tr>\n      <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">主题</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(fldtopic)+"&nbsp;</font>");
      out.println("</td>\n     </tr>");
      out.print("     <tr>\n      <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">作者</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(fldauthor)+"&nbsp;</font>");
      out.println("</td>\n     </tr>");
      out.print("     <tr>\n      <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">发表日期</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(flddate_entered)+"&nbsp;</font>");
      out.println("</td>\n     </tr>");
      out.print("     <tr>\n      <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">文章内容</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+fldmessage+"&nbsp;</font>");
      out.println("</td>\n     </tr>");
      out.println("     <tr>\n      <td colspan=\"2\" >&nbsp;</td>\n     </tr>");
    
      iCounter++;
    }
    if (iCounter == 0) {
      // Recordset is empty
      out.println(sNoRecords);
    
      iCounter = RecordsPerPage+1;
      bIsScroll = false;
    }

    else {

  
    // Parse scroller
    boolean bInsert = false;
    boolean bNext = rs.next();
    if ( !bNext && iPage == 1 ) {
    
    }
    else {
      out.print("     <tr>\n      <td colspan=\"2\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
    
      if ( iPage == 1 ) {
        out.print("\n       <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
      }
      else {
        out.print("\n       <a href=\""+sFileName+"?"+formParams+sSortParams+"Formreplies_Page="+(iPage - 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
      }
  
      out.print("\n       [ "+iPage+" ]");
  
      if (!bNext) { 
        out.print("\n       <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
      }
      else {
        out.print("\n       <a href=\""+sFileName+"?"+formParams+sSortParams+"Formreplies_Page="+(iPage + 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
      }
    
      out.println("</td>\n     </tr>");
    }
  
    }

    if ( rs != null ) rs.close();
    out.println("    </table>");
    
  }
  catch (Exception e) { out.println(e.toString()); }
}
%>

⌨️ 快捷键说明

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