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

📄 smsbbs_jsp.java

📁 做的非常好的论坛
💻 JAVA
字号:
package org.apache.jsp.bbs;

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

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

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(2);
    _jspx_dependants.add("/bbs/checkbbsuser.jsp");
    _jspx_dependants.add("/bbs/../inc/conn.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\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');

String username=null;
username = (String)session.getAttribute("name");
if(username==""||username==null)
{	
  out.print("<script language='javascript'>");
  out.print("alert('你还没有登录论坛,请先登录!');");
  out.print("history.go(-1);");
  out.print("</script>");
  out.close();
}

      out.write('\r');
      out.write('\n');
      out.write('\r');
      out.write('\n');
      out.write('\r');
      out.write('\n');

     //java.sql.Connection conn;
     //java.sql.Statement stmt;
     //java.sql.ResultSet rs;
     //Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
     //String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bbs";
     //String user="sa";
     //String password="";
     //conn=DriverManager.getConnection(url,user,password);
     //stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); 
//String url="jdbc:jtds:sqlserver://localhost:1433/bbs;USER=sa;PASSWORD="; 
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  String url="jdbc:odbc:db2000";

Connection conn= DriverManager.getConnection(url); 
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); 
//Statement stmt=conn.createStatement();
/*String sql="select BBS_Cate_Name,BBS_Cate_ID,BBS_Cate_PID from BBS_Cate where BBS_Cate_PID='0' and BBS_Cate_ID<>'A_3' and deleted=0 order by totop asc";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
out.print(rs.getString("BBS_Cate_Name"));*/
/*String BoardID_1="1",BoardID_2="2",user_id="123",name="3",title="4",menu="5",IP="6",date1="20:00:10",redate="20:00:10",zhiye="123",bbs_img_display="123",bbs_img_text="123",img_url_display="123",deleted="123",picture="123";
String sql="insert into bbstitle(BoardID_1,BoardID_2,user_id,name,title,menu,ip,date1,redate,zhiye,bbs_img_display,bbs_img_text,img_url_display,deleted,picture)";
sql=sql=sql+" values('"+BoardID_1+"','"+BoardID_2+"','"+user_id+"','"+name+"','"+title+"','"+menu+"','"+IP+"','"+date1+"','"+redate+"',"+zhiye+",1,'"+bbs_img_text+"',0,0,'"+picture+"')";
stmt.executeUpdate(sql);*/



/*while(rs.next())
{

   out.print(rs.getObject("id"));
}*/

      out.write('\r');
      out.write('\n');

String sql,sender,accepter,title,content;
String postuser = new String(request.getParameter("postuser").getBytes("iso-8859-1"));
String act = request.getParameter("act");
String id = request.getParameter("id");
if(act!=null)
{
sender=(String)session.getAttribute("name");
accepter=postuser;
title=new String(request.getParameter("title").getBytes("iso-8859-1"));
content=new String(request.getParameter("content").getBytes("iso-8859-1"));

sql="insert into sms(title,content,sender,accepter) values('"+title+"','"+content+"','"+sender+"','"+accepter+"')";
stmt.executeUpdate(sql);
out.print("<script language='javascript'>");
out.print("alert('发送成功!');");
out.print("history.go(-2);");
out.print("</script>");
out.close();
stmt.close(); 
conn.close();
}
else
{

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<LINK href=\"../css/xmwuye.css\" rel=stylesheet type=text/css>\r\n");
      out.write("<title>论坛短信系统</title>\r\n");
      out.write("</head>\r\n");
      out.write("<script language=\"javascript\">\r\n");
      out.write("<!--\r\n");
      out.write("\tfunction check(form)\r\n");
      out.write("\t{\r\n");
      out.write("    if (form.title.value==\"\")\r\n");
      out.write("    \t{\r\n");
      out.write("    \t\talert(\"请填写标题!\");\r\n");
      out.write("    \t\tform.title.focus();\r\n");
      out.write("    \t\treturn false;\r\n");
      out.write("  \t}\r\n");
      out.write("    if (form.content.value==\"\")\r\n");
      out.write("    \t{\r\n");
      out.write("    \t\talert(\"请填写内容!\");\r\n");
      out.write("    \t\tform.content.focus();\r\n");
      out.write("    \t\treturn false;\r\n");
      out.write("  \t}\r\n");
      out.write("return true;\r\n");
      out.write("\t}\r\n");
      out.write("//-->\r\n");
      out.write("</script>\r\n");
      out.write("<body topmargin=\"5\">\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("  <TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width=\"99%\">\r\n");
      out.write("    <TR> \r\n");
      out.write("      <TD height=25> <div align=\"center\"><font color=\"#FFFFFF\"><strong>欢迎<font color=\"#CC3300\">");
      out.print(session.getAttribute("name"));
      out.write("</font>网友来发送短信</strong></font></div></TD>\r\n");
      out.write("    </TR>\r\n");
      out.write("  </TABLE>\r\n");
      out.write("  <TABLE align=\"center\" bgColor=\"#a4b6d7\" border=0 cellPadding=0 cellSpacing=0 width=\"99%\">\r\n");
      out.write("    <TBODY>\r\n");
      out.write("      <TR bgColor=#f2f8ff> \r\n");
      out.write("        <TD height=\"28\" vAlign=middle bgColor=#b1d6fa class=font10_5> \r\n");
      out.write("          <div align=\"center\">发送短信</div></TD>\r\n");
      out.write("      </TR>\r\n");
      out.write("    </TBODY>\r\n");
      out.write("  </TABLE>\r\n");
      out.write("  <TABLE width=\"99%\" border=0 align=\"center\" cellPadding=0 cellSpacing=0 bgColor=\"#FFFFFF\">\r\n");
      out.write("    <TBODY>\r\n");
      out.write("      <TR bgColor=#f2f8ff> \r\n");
      out.write("        <TD vAlign=middle bgColor=#f6f6f6 class=font10_5><div align=\"center\">\r\n");
      out.write("            <form name=\"form2\" method=\"post\" action=\"\" style=\"MARGIN-BOTTOM: 0px\" onsubmit=\"return check(this)\">\r\n");
      out.write("              <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                <tr> \r\n");
      out.write("                  <td width=\"17%\" height=\"30\"> \r\n");
      out.write("                    <div align=\"right\">用户:</div></td>\r\n");
      out.write("                  <td width=\"83%\" height=\"25\">\r\n");
      out.write("<input name=\"postuser\" type=\"text\" id=\"postuser\" value=\"");
      out.print(postuser);
      out.write("\" readonly>\r\n");
      out.write("                  </td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr>\r\n");
      out.write("                  <td width=\"17%\" height=\"30\">\r\n");
      out.write("<div align=\"right\">标题:</div></td>\r\n");
      out.write("                  <td><input name=\"title\" type=\"text\" id=\"title\" size=\"50\"></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr> \r\n");
      out.write("                  <td height=\"25\"><div align=\"right\">内容:</div></td>\r\n");
      out.write("                  <td><textarea name=\"content\" cols=\"70\" rows=\"20\" id=\"content\"></textarea></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr> \r\n");
      out.write("                  <td height=\"30\"><div align=\"right\"></div></td>\r\n");
      out.write("                  <td><input type=\"submit\" name=\"Submit2\" value=\"发送\"> <input name=\"cannel\" type=\"reset\" id=\"cannel\" value=\"重置\"> \r\n");
      out.write("                    <input name=\"act\" type=\"hidden\" id=\"act\" value=\"y\"> <input name=\"id\" type=\"hidden\" id=\"id\" value=\"");
      out.print(id);
      out.write("\">\r\n");
      out.write("                    </td>\r\n");
      out.write("                </tr>\r\n");
      out.write("              </table>\r\n");
      out.write("            </form>\r\n");
      out.write("          </div></TD>\r\n");
      out.write("      </TR>\r\n");
      out.write("    </TBODY>\r\n");
      out.write("  </TABLE>\r\n");
      out.write("  <script language=\"JavaScript\" src=\"../inc/bbstail.js\"></script>\r\n");
      out.write("</div>\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 + -