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

📄 registeraction.java

📁 这个程序是花了好几十万请人开发的
💻 JAVA
字号:

package struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import javabean.ConnectionPool;
import javabean.dbconnect;

import struts.form.RegisterForm;

import java.sql.*;
import javabean.PubDate;

public class RegisterAction extends Action {
	
	private ConnectionPool pool;
	private Connection con;
	
	public RegisterAction(){
		pool=ConnectionPool.getInstance();               //初始化连接池
	}

	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception 
		{
			
		HttpSession session=request.getSession();
		
		RegisterForm ownerForm = (RegisterForm) form;
		
		String uid = ownerForm.getUid();
		  //uid=new String(uid.getBytes("ISO-8859-1"));
		String pwd=ownerForm.getPwd1();
		String question=ownerForm.getQuestion();
		   question=new String(question.getBytes("ISO-8859-1"));
		String answer=ownerForm.getAnswer();
		   answer=new String(answer.getBytes("ISO-8859-1"));
		//
		String rname =ownerForm.getRname().trim();
		  rname=new String(rname.getBytes("ISO-8859-1"));
		String sex=ownerForm.getSex();
		  sex=new String(sex.getBytes("ISO-8859-1"));	 
		String address=ownerForm.getAddress();
		  address=new String(address.getBytes("ISO-8859-1"));
		String email=ownerForm.getEmail();
		String postcode=ownerForm.getPostcode();
		String province=ownerForm.getProvince();
		  province=new String(province.getBytes("ISO-8859-1"));
		String city=ownerForm.getCity();
		  city=new String(city.getBytes("ISO-8859-1"));
		String company=ownerForm.getCompany();
		  company=new String(company.getBytes("ISO-8859-1"));
		String homepage=ownerForm.getHomepage();
		homepage=new String(homepage.getBytes("ISO-8859-1"));
		
		String mobile=ownerForm.getMobile();		
		String tel=ownerForm.getTel();
		String fax=ownerForm.getFax();
		
		session.setAttribute("rname",rname);
		session.setAttribute("sex",sex);

		//以下是连接数据库

        dbconnect db=new dbconnect();
		ResultSet rs1; 
		ResultSet rs2;
		PubDate date1=new PubDate();
        String date=date1.getDate();
		  int id = 0;
		  String sql="select max(id) as counter from MEMBER";
		  rs1= db.executeQuery(sql);
		  while(rs1.next())
		  {
			id = rs1.getInt("counter");
		  }
				 		  
		 id +=1;
		 String s= "'"+id+"'"+","+"'"+uid+"'"+","+"'"+pwd+"'"+","+"'"+email+"'"+","+"'0'"+","+"'"+rname+"'"+","+"'"+sex+"'"+","+"'"+date+"'"+","+"'"+province+"'"+","+"'"+postcode+"'"+","+"'"+city+"'"+","+"'"+tel+"'"+","+"'"+mobile+"'"+","+"'"+fax+"'"+","+"'"+address+"'"+","+"'"+question+"'"+","+"'"+answer+"'"+","+"'"+company+"'"+","+"'"+homepage+"'";
		 sql="insert into MEMBER(ID,UUID,PWD,EMAIL,TIMES,RNAME,SEX,DATE1,USER_PROVINCE,USER_POST_CODE,USER_CITY,USER_HOMEPH,USER_OFFICEPH,USER_MOBILEPH,USER_ADDRESS,QUESTION,ANSWER,COMPANY,HOMEPAGE) values"+"("+s+")";
		 rs2=db.executeQuery(sql);
	     ownerForm.reset(mapping,request);

         String sql2="insert into USERTABLE values "+"('"+uid+"'"+","+"'"+pwd+"'"+","+"'0'"+","+"'"+sex+"'"+","+"'"+rname+"')";
         ResultSet rs3=db.executeQuery(sql2);
         
		return (mapping.findForward("login"));
		
	}

}

⌨️ 快捷键说明

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