controller/member/MemberJoin.java
페이지 정보
본문
package controller.member;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.MemberDAO;
import model.Member;
@WebServlet("/member/join")
public class MemberJoin extends HttpServlet {
private static final long serialVersionUID = 1L;
public MemberJoin() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher dis = request.getRequestDispatcher("join.jsp");
dis.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
String id = request.getParameter("mb_id");
Member m = new Member();
m.setId(request.getParameter("mb_id"));
m.setPass(request.getParameter("mb_pass"));
m.setName(request.getParameter("mb_name"));
m.setEmail(request.getParameter("mb_email"));
m.setAge(Integer.parseInt(request.getParameter("mb_age")));
m.setGender(request.getParameter("mb_gender"));
m.setLevel("1"); //레밸 1
m.setMemo(request.getParameter("mb_memo"));
MemberDAO dao = new MemberDAO();
int num = dao.loginSelect(id); //아이디 존재여부
if(num == 1) { //아이디 존재
//출력 구문
response.setContentType("text/html; charset=utf-8");
PrintWriter out = response.getWriter();
out.print("<script>");
out.print("alert('존재하는 아이디입니다.');");
out.print("history.back();");
out.print("</script>");
}else {
dao.insertMember(m);
response.sendRedirect("/");
}
}
}
- 이전글controller/member/Logout.java 23.03.17
- 다음글controller/member/MemberModify.java 23.03.17
댓글목록
등록된 댓글이 없습니다.