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

📄 addcheck_0002ejsp_jsp.java

📁 流言板 用JBUILDER开发的 实用方便 需要的尽管拿去用
💻 JAVA
字号:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class addcheck_0002ejsp_jsp extends HttpJspBase {

    // begin [file="/addcheck.jsp";from=(8,0);to=(8,80)]
    // end

    static {
    }
    public addcheck_0002ejsp_jsp( ) {
    }

    private static boolean _jspx_inited = false;

    public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
    }

    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;
        String  _value = null;
        try {

            if (_jspx_inited == false) {
                synchronized (this) {
                    if (_jspx_inited == false) {
                        _jspx_init();
                        _jspx_inited = true;
                    }
                }
            }
            _jspxFactory = JspFactory.getDefaultFactory();
            response.setContentType("text/html; charset=GBK");
            pageContext = _jspxFactory.getPageContext(this, request, response,
            			"", true, 8192, true);

            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();

            // HTML // begin [file="/addcheck.jsp";from=(0,48);to=(1,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/addcheck.jsp";from=(1,31);to=(8,0)]
                out.write("\r\n<html>\r\n<head>\r\n<title>\r\naddcheck\r\n</title>\r\n</head>\r\n");

            // end
            // begin [file="/addcheck.jsp";from=(8,0);to=(8,80)]
                com.test.DB.DBConnManager bean0 = null;
                boolean _jspx_specialbean0  = false;
                 synchronized (application) {
                    bean0= (com.test.DB.DBConnManager)
                    pageContext.getAttribute("bean0",PageContext.APPLICATION_SCOPE);
                    if ( bean0 == null ) {
                        _jspx_specialbean0 = true;
                        try {
                            bean0 = (com.test.DB.DBConnManager) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.test.DB.DBConnManager");
                        } catch (ClassNotFoundException exc) {
                             throw new InstantiationException(exc.getMessage());
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create bean of class "+"com.test.DB.DBConnManager", exc);
                        }
                        pageContext.setAttribute("bean0", bean0, PageContext.APPLICATION_SCOPE);
                    }
                 } 
                if(_jspx_specialbean0 == true) {
            // end
            // begin [file="/addcheck.jsp";from=(8,0);to=(8,80)]
                }
            // end
            // HTML // begin [file="/addcheck.jsp";from=(8,80);to=(9,0)]
                out.write("\r\n");

            // end
            // begin [file="/addcheck.jsp";from=(9,0);to=(9,45)]
                JspRuntimeLibrary.introspect(pageContext.findAttribute("bean0"), request);
            // end
            // HTML // begin [file="/addcheck.jsp";from=(9,45);to=(12,0)]
                out.write("\r\n<body background=\"bj.gif\">\r\n<br><br><br><br>\r\n");

            // end
            // begin [file="/addcheck.jsp";from=(12,2);to=(52,0)]
                
                 String uemail = request.getParameter("email");
                    if (uemail == null) {
                      uemail = "";
                    }
                String uname=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK");
                   // String uname = request.getParameter("name");
                    if (uname == null) {
                      uname = "";
                    }
                String ucontent=new String(request.getParameter("content").getBytes("ISO8859_1"),"GBK");
                   // String ucontent = request.getParameter("content");
                    if (ucontent == null) {
                      ucontent = "";
                    }
                 Connection con=bean0.getConnection("access");
                    if(con==null)
                    {
                     System.out.println("对不起,现在数据库忙,请稍后再试");
                
                    }
                int result=0;
                int id=0;
                Statement stmt=con.createStatement();
                 Statement stmt1=con.createStatement();
                    try{
                
                 String queryStr = "select max(id) from liuyan";
                    // stmt = conn.createStatement();
                 ResultSet rs =stmt.executeQuery(queryStr);
                
                 if(rs.next()){
                 id=rs.getInt(1);}
                 id=id+1;
                 String sql = "insert into liuyan(id,ip,email,[time],content,name)"+" values("+ id +",'" +
                              (String)request.getRemoteHost() + "','" + uemail + "','" + (String)bean0.gettime() + "','" + ucontent + "','" + uname + "')";
                 result =stmt1.executeUpdate(sql);
                
                    }catch(Exception e){
                      e.printStackTrace();
            // end
            // HTML // begin [file="/addcheck.jsp";from=(52,2);to=(53,0)]
                out.write("<p align=\"center\"><a href=\"show.jsp\">发表失败,请返回</a></p>\r\n");

            // end
            // begin [file="/addcheck.jsp";from=(53,2);to=(60,0)]
                
                    // response.sendRedirect("error.jsp");
                    }
                stmt.close();
                stmt1.close();
                bean0.releaseConnection("access",con);
                if(result!=0){
            // end
            // HTML // begin [file="/addcheck.jsp";from=(60,2);to=(61,0)]
                out.write("<p align=\"center\"><a href=\"show.jsp\">发表成功,返回留言板</a></p>\r\n");

            // end
            // begin [file="/addcheck.jsp";from=(61,2);to=(65,0)]
                }
                
                
                
            // end
            // HTML // begin [file="/addcheck.jsp";from=(65,2);to=(69,0)]
                out.write("\r\n\r\n</body>\r\n</html>\r\n");

            // end

        } catch (Throwable t) {
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (pageContext != null) pageContext.handlePageException(t);
        } finally {
            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
        }
    }
}

⌨️ 快捷键说明

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