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

📄 reply.jsp

📁 功能比较全的一个论坛
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ include file="Common.jsp" %><%!
//
//   Filename: reply.jsp


static final String sFileName = "reply.jsp";
              
static final String PageBODY = "link=\"#000000\" vlink=\"#0033cc\" alink=\"red\"";
static final String FormTABLE = "border=\"0\" cellspacing=\"1\" cellpadding=\"3\"";
static final String FormHeaderTD = "bgcolor=\"#c2c2c2\"";
static final String FormHeaderFONT = "face=\"arial\" style=\"font:bold\" color=\"#0033cc\"";
static final String FieldCaptionTD = "bgcolor=\"#f2f2f2\"";
static final String FieldCaptionFONT = "face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"";
static final String DataTD = "";
static final String DataFONT = "face=\"arial\" size=\"2\"";
static final String ColumnFONT = "face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"";
static final String ColumnTD = "bgcolor=\"#f2f2f2\"";
%><%

boolean bDebug = false;

String sAction = getParam( request, "FormAction");
String sForm = getParam( request, "FormName");
String sreplyErr = "";
String soriginalErr = "";

java.sql.Connection conn = null;
java.sql.Statement stat = null;
String sErr = loadDriver();
conn = cn();
stat = conn.createStatement();
if ( ! sErr.equals("") ) {
 try {
   out.println(sErr);
 }
 catch (Exception e) {}
}
if ( sForm.equals("reply") ) {
  sreplyErr = replyAction(request, response, session, out, sAction, sForm, conn, stat);
  if ( "sendRedirect".equals(sreplyErr)) return;
}

%>            
<html>
<head>
<title>Forum</title>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body link="#000000" vlink="#0033cc" alink="red">
<jsp:include page="header.jsp" flush="true"/>
 <table>
  <tr>
   
   <td valign="top">
<% original_Show(request, response, session, out, soriginalErr, sForm, sAction, conn, stat); %>
    
   </td>
  </tr>
 </table>
 <table>
  <tr>
   <td valign="top">
<% reply_Show(request, response, session, out, sreplyErr, sForm, sAction, conn, stat); %>
    
   </td>
  </tr>
 </table>


</body>
</html>
<%%>
<%
if ( stat != null ) stat.close();
if ( conn != null ) conn.close();
%>
<%!


  String replyAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sAction, String sForm, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
  
    String sreplyErr ="";
    try {

      if (sAction.equals("")) return "";

      String sSQL="";
      String transitParams = "";
      String primaryKeyParams = "";
      String sQueryString = "";
      String sPage = "";
      String sParams = "";
      String sActionFileName = "index.jsp";
      String sWhere = " ";
      boolean bErr = false;
      long iCount = 0;

  
      String pPKmessage_id = "";

      final int iinsertAction = 1;
      final int iupdateAction = 2;
      final int ideleteAction = 3;
      int iAction = 0;

      if ( sAction.equalsIgnoreCase("insert") ) { iAction = iinsertAction; }
      if ( sAction.equalsIgnoreCase("update") ) { iAction = iupdateAction; }
      if ( sAction.equalsIgnoreCase("delete") ) { iAction = ideleteAction; }

      // Create WHERE statement


      String fldmid="";
      String fldtopic="";
      String fldauthor="";
      String fldmessage="";
      String flddate_entered="";
      String fldmessage_id="";

      // Load all form fields into variables
    
      fldmid = getParam( request, "Rqd_mid");
      fldtopic = getParam(request, "topic");
      fldauthor = getParam(request, "author");
      fldmessage = getParam(request, "message");
      flddate_entered = getParam(request, "date_entered");
      // Validate fields
      if ( iAction == iinsertAction || iAction == iupdateAction ) {
        if (sreplyErr.length() > 0 ) {
          return (sreplyErr);
        }
      }


      sSQL = "";
      // Create SQL statement

      switch (iAction) {
  
        case iinsertAction :
          
            sSQL = "insert into messages (" + 
                "message_parent_id," +
                "topic," +
                "author," +
                "message," +
                "date_entered)" +

                " values (" + 
                toSQL(fldmid, adNumber) + "," +
                toSQL(fldtopic, adText) + "," +
                toSQL(fldauthor, adText) + "," +
                toSQL(fldmessage, adText) + "," +
                toSQL(flddate_entered, adDate) + ")";
          break;
  
      }

      if ( sreplyErr.length() > 0 ) return sreplyErr;
      try {
        // Execute SQL statement
        stat.executeUpdate(sSQL);
      }
      catch(java.sql.SQLException e) {
        sreplyErr = e.toString(); return (sreplyErr);
      }
  
      try {
        if ( stat != null ) stat.close();
        if ( conn != null ) conn.close();
      }
      catch ( java.sql.SQLException ignore ) {}
      response.sendRedirect (sActionFileName);

      return "sendRedirect";
    }
    catch (Exception e) {out.println(e.toString()); }
    return (sreplyErr);
  }

  


  void reply_Show(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sreplyErr, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
    try {

      String sSQL="";
      String sQueryString = "";
      String sPage = "";
      String sWhere = "";
      String transitParams = "";
      String transitParamsHidden = "";
      String requiredParams = "";
      String primaryKeyParams ="";
      java.util.Hashtable rsHash = new java.util.Hashtable();
      
      String pmessage_id = "";

      String fldmessage_id="";
      String fldmid="";
      String fldtopic="";
      String fldauthor="";
      String fldmessage="";
      String flddate_entered="";


      boolean bPK = true;

      if ( "".equals(sreplyErr)) {
        // Load primary key and form parameters
        fldmessage_id = getParam( request, "message_id");

⌨️ 快捷键说明

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