www.pudn.com > bookshop.zip > RegisterOK.java, change:2013-07-08,size:1227b


package com.tarena.web; 
 
import java.io.IOException; 
import java.io.PrintWriter; 
import java.sql.Connection; 
import java.sql.Date; 
import java.sql.PreparedStatement; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import com.tarena.bean.User; 
import com.tarena.dao.UserDao; 
import com.tarena.util.DB; 
 
public class RegisterOK extends HttpServlet { 
 
	public void service(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException { 
		 
		     request.setCharacterEncoding("utf-8"); 
	         response.setContentType("text/html;charset=utf-8"); 
 
             String nickname = request.getParameter("nickname"); 
         	 String email = request.getParameter("email"); 
         	 String password = request.getParameter("password"); 
         	  
         	  User user = new User(); 
         	  user.setEmail(email); 
         	  user.setNickname(nickname); 
         	  user.setPwd(password); 
         	  UserDao dao = new UserDao(); 
   		      dao.saveUser(user); 
   		      response.sendRedirect("login.jsp"); 
             
	} 
 
}