You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
package org.use.servlet;
|
|
|
|
import java.io.IOException;
|
|
import java.io.PrintWriter;
|
|
|
|
import javax.servlet.ServletException;
|
|
import javax.servlet.http.HttpServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.use.entity.Use;
|
|
import org.use.service.UseService;
|
|
|
|
/**
|
|
* Servlet implementation class RegUseServlet
|
|
*/
|
|
public class RegUseServlet extends HttpServlet {
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
String username= request.getParameter("username");
|
|
String password= request.getParameter("password");
|
|
int phonenum= Integer.parseInt(request.getParameter("phonenum"));
|
|
String email= request.getParameter("email");
|
|
Use use =new Use(username,password,phonenum,email);
|
|
|
|
UseService useService = new UseService();
|
|
boolean result = useService.regUse(use);
|
|
PrintWriter out = response.getWriter() ;
|
|
if(result) {
|
|
out.println("注册成功") ;
|
|
}else {
|
|
out.println("注册失败");
|
|
}
|
|
}
|
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
doGet(request, response);
|
|
}
|
|
|
|
}
|