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

📄 wangyingzhuce.java

📁 网上银行 JSP开发~JAVASript貌似有点多
💻 JAVA
字号:
package pp;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class WangYingZhuCe extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public WangYingZhuCe() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {

		response.setContentType("text/html;charset=gb2312");
		PrintWriter out = response.getWriter();			 
		dbconn conn=new dbconn();
		ResultSet rs=null;
		String accountNum=new String(request.getParameter("accountNum").getBytes("ISO8859_1"));
		String accpasswd=new String(request.getParameter("accpasswd").getBytes("ISO8859_1"));
		String username=new String(request.getParameter("username").getBytes("ISO8859_1"));
		String PASSWORD1=new String(request.getParameter("PASSWORD1").getBytes("ISO8859_1"));
		String PHOTOIDTYPE=new String(request.getParameter("PHOTOIDTYPE").getBytes("ISO8859_1"));
		String PHOTOIDNUMBER=new String(request.getParameter("PHOTOIDNUMBER").getBytes("ISO8859_1"));
		String sql="select PASSWORD,WWW from ACCOUNT where ACCOUNTNUMBER='"+accountNum+"'";
		String sql1="select USERNAME from BANKCUSTOMER where USERNAME='"+username+"'";
	    try {

				rs=conn.executeQuery(sql);
				if(rs.next()==true){
					if(rs.getString("PASSWORD").equals(accpasswd)){
						if(rs.getString("WWW").equals("是")){
							out.print("<script language='javascript'>");
			                out.print("alert('该帐户已开通网银');");
			                out.print("history.go(-1);");
			                out.print("</script>");
						}else{
							rs=conn.executeQuery(sql1);
							if(rs.next()==true){
								out.print("<script language='javascript'>");
				                out.print("alert('该用户名已存在,请重新输入');");
				                out.print("history.go(-1);");
				                out.print("</script>");
							}else{
								String sq="insert into BANKCUSTOMER values('"+accountNum+"','"+username+"','"+PASSWORD1+"','"+PHOTOIDTYPE+"','"+PHOTOIDNUMBER+"')";
								conn.executeUpdate(sq);
								conn.executeUpdate("update ACCOUNT set www='是' where ACCOUNTNUMBER='"+accountNum+"'");
								out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
								out.println("<HTML>");
								out.println("  <HEAD><TITLE>A Servlet</TITLE>");
								out.println("</HEAD>");
								out.println("  <BODY>");
								out.println("操作已成功!<BR>");
								out.println("  </BODY>");
								out.println("</HTML>");
							}
						}
						
					}else{
						out.print("<script language='javascript'>");
		                out.print("alert('帐号密码不正确!');");
		                out.print("history.go(-1);");
		                out.print("</script>");
					}
							
			}else{
				out.print("<script language='javascript'>");
                out.print("alert('该帐户不存在');");
                out.print("history.go(-1);");
                out.print("</script>");
				}
			conn.closeConn();	
		  }catch(Exception e){
			  e.printStackTrace();
		  }
									
	}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
* 
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
	public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {

		doGet(request,response);
	}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
	public void init() throws ServletException {
		// Put your code here
	}

}

⌨️ 快捷键说明

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