package servlet; import java.io.IOException; 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 model.MMPC002form; import validate.S002; import validate.S010; @WebServlet("/MMPC002") public class MMPC002 extends HttpServlet { private static final long serialVersionUID = 1L; /*値取得の為"POSTメッソド"指定*/ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // doGet(request, response); response.setContentType("text/html; charset=UTF-8"); request.setCharacterEncoding("UTF-8"); /*リクエストパラメーター取得*/ String name = request.getParameter("name"); String mail = request.getParameter("mail"); String password = request.getParameter("password"); String year = request.getParameter("year"); String month = request.getParameter("month"); String day = request.getParameter("day"); /*Beanへ値設定*/ MMPC002form mmpc002 = new MMPC002form(); mmpc002.setName(name); mmpc002.setMail(mail); mmpc002.setPassword(password); /*以下エラーチェッククラス*/ /*メールアドレス重複チェック*/ S002 s002 = new S002(); String er = s002.validate(mmpc002.getMail()); mmpc002.setEr(er); /*半角スペースチェック*/ S010 s010 = new S010(); String er1 = s010.getUserData(mmpc002.getMail()); mmpc002.setEr1(er1); /*リクエストスコープへ設定*/ request.setAttribute("MMPC002", mmpc002); /*遷移先指定*/ RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/MMPC003.jsp"); dispatcher.forward(request, response); } }