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

📄 reg_005fok_jsp.java

📁 JSP版的在线相册系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

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

  private static java.util.Vector _jspx_dependants;

  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,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\n");
      out.write("<title>用户注册</title>\n");
      out.write("<style type=\"text/css\">\n");
      out.write("<!--\n");
      out.write("body {\n");
      out.write("\tbackground-color: #FFFFCC;\n");
      out.write("}\n");
      out.write("-->\n");
      out.write("</style></head>\n");
      out.write("<body>\n");
      out.write(" ");
      photo.StrFormat format = null;
      synchronized (_jspx_page_context) {
        format = (photo.StrFormat) _jspx_page_context.getAttribute("format", PageContext.PAGE_SCOPE);
        if (format == null){
          format = new photo.StrFormat();
          _jspx_page_context.setAttribute("format", format, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');
      out.write(' ');
      photo.DBConnection dbconn = null;
      synchronized (_jspx_page_context) {
        dbconn = (photo.DBConnection) _jspx_page_context.getAttribute("dbconn", PageContext.PAGE_SCOPE);
        if (dbconn == null){
          dbconn = new photo.DBConnection();
          _jspx_page_context.setAttribute("dbconn", dbconn, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\n");
      out.write(" <p>&nbsp;</p>\n");
      out.write(" <p>&nbsp;</p>\n");
      out.write(" <p align=\"center\">\n");
      out.write("   ");
try{   Connection conn=dbconn.getConnection();//连接数据库  Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);/*获取表单传递过来的注册信息*/  String user_name=request.getParameter("account"); String password=request.getParameter("pwd"); String name=format.StrFormat(request.getParameter("name"));//获取name参数并转化格式,避免出现乱码 String sex=request.getParameter("sex"); if (sex.equals("2")) {            sex = "female";        } else {            sex = "male";            } String age=request.getParameter("age"); String tel=request.getParameter("tel"); String address=format.StrFormat(request.getParameter("address")); String email=request.getParameter("email"); String sql="insert into users(user_name,password,name,sex,age,tel,address,email) values('"+user_name+"','"+password+"','"+name+"','"+sex+"',"+age+",'"+tel+"','"+address+"','"+email+"')";//插入记录的SQL语句 int i=stmt.executeUpdate(sql); if (i==1)   {     out.println("恭喜,注册成功!");   
      out.write("\n");
      out.write("   <br>\n");
      out.write("   <font color=\"#ff0000\"></font><a href=\"index.jsp\">返回到登陆页面</a>\n");
      out.write("</p>\n");
      out.write(" <div align=\"center\">\n");
      out.write("    ");
   } else{ out.println("注册时发生错误,请重新注册!"); 
      out.write("\n");
      out.write(" </div>\n");
      out.write(" <div align=\"center\">\n");
      out.write(" ");
}
      out.write('\n');
      out.write(' ');
 stmt.close();conn.close();//关闭数据库链接   }   catch(Exception e){e.printStackTrace();}   
      out.write("\n");
      out.write(" </div>\n");
      out.write("</body>\n");
      out.write("</html>\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 + -