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

📄 category_005fadd_jsp.java

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

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 Category_005fadd_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("/bbsadmin/../admin/checkmaster.jsp");
    _jspx_dependants.add("/bbsadmin/../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 bbsadmin=null;
bbsadmin = (String)session.getAttribute("bbsadmin");
if(bbsadmin==""||bbsadmin==null)
{
  out.print("<script>window.open('../admin/index.jsp');</script>");
  //out.print("<script>");
  //out.print("alert('你的权限太低无法进入!');");
  //out.print("window.location.href='../admin/index.jsp';");
  //out.print("</script>");
}

      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,strsql,BBS_Cate_ID,BBS_Cate_Name,BBS_Cate_Manager_Name,BBS_Cate_Manager_Email,BBS_Cate_PID,Layer;
      out.write('\r');
      out.write('\n');

String sql,strsql,BBS_Cate_ID,BBS_Cate_Name,BBS_Cate_Manager_Name,BBS_Cate_Manager_Email,BBS_Cate_PID,Layer;

BBS_Cate_Name=new String(request.getParameter("BBS_Cate_Name").getBytes("iso-8859-1"));
BBS_Cate_Manager_Name=new String(request.getParameter("BBS_Cate_Manager_Name").getBytes("iso-8859-1"));
BBS_Cate_Manager_Email=new String(request.getParameter("BBS_Cate_Manager_Email").getBytes("iso-8859-1"));
BBS_Cate_PID=request.getParameter("BBS_Cate_PID");
Layer=request.getParameter("layer");
if(Layer==null)
Layer="0";
int layerint = Integer.parseInt(Layer);

strsql="select top 1 * from BBS_CATE where BBS_Cate_PID='"+BBS_Cate_PID+"' order by BBS_ID desc";
ResultSet rs=stmt.executeQuery(strsql);

if(!rs.next()){ //没有相同类别的数据,初始化开始值
    if(Layer.equals("0")){
	  BBS_Cate_ID = "A_1";
	}
	else
	{
	BBS_Cate_ID = BBS_Cate_PID+"_1";
	}
}
else
{
    BBS_Cate_ID=rs.getString("BBS_Cate_ID");
	int a=BBS_Cate_ID.indexOf("_");
	int b=BBS_Cate_ID.lastIndexOf("_");
	int len=BBS_Cate_ID.length();
	String k=BBS_Cate_ID.substring(b+1,len);
	String str_1=BBS_Cate_ID.substring(0,b);
	int str_2 = Integer.parseInt(k);
	str_2=str_2+1;
	BBS_Cate_ID=str_1+"_"+str_2;
} 
rs.close(); 
sql="insert into BBS_CATE(BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Name,BBS_Cate_Topic,BBS_Cate_Reply,BBS_Cate_Manager_Name,BBS_Cate_Manager_Email) values('"+BBS_Cate_ID+"','"+BBS_Cate_PID+"','"+BBS_Cate_Name+"','0','0','"+BBS_Cate_Manager_Name+"','"+BBS_Cate_Manager_Email+"')";
//out.print(sql);
//out.close();
stmt.executeUpdate(sql);


stmt.close(); 
conn.close();
response.sendRedirect(request.getHeader("referer"));

    } 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 + -