Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%@ page import= "user.UserDAO" %>
- <%@ page import= "java.io.PrintWriter" %>
- <% request.setCharacterEncoding("UTF-8"); %>
- <jsp:useBean id="user" class="user.User" scope="page" />
- <jsp:setProperty name="user" property="userId" />
- <jsp:setProperty name="user" property="userPassword" />
- <jsp:setProperty name="user" property="userName" />
- <jsp:setProperty name="user" property="userGender" />
- <jsp:setProperty name="user" property="userEmail" />
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>jsp 게시판 웹사이트</title>
- </head>
- <body>
- <%
- String userId = null;
- if(session.getAttribute("userId") != null) {
- userId = (String) session.getAttribute("userId");
- }
- if (userId != null ) {
- PrintWriter script = response.getWriter();
- script.println("<script>");
- script.println("alert('이미 로그인이 되어 있습니다. ')");
- script.println("location.href= main.jsp");
- script.println("</script>");
- }
- if (user.getUserId()==null || user.getUserPassword()==null || user.getUserName() ==null ||
- user.getUserGender()==null || user.getUserEmail()==null) {
- PrintWriter script = response.getWriter();
- script.println("<script>");
- script.println("alert('입력이 안 된 사항이 있습니다.')");
- script.println("history.back()");
- script.println("</script>");
- } else {
- UserDAO userDAO = new UserDAO();
- int result = userDAO.join(user);
- if(result== - 1) {
- PrintWriter script = response.getWriter();
- script.println("<script>");
- script.println("alert('이미 존재하는 아이디입니다.')");
- script.println("history.back()");
- script.println("</script>");
- } else {
- PrintWriter script = response.getWriter();
- script.println("<script>");
- script.println("alert('비밀번호가 틀립니다.')");
- script.println("history.back()");
- script.println("</script>");
- }
- }
- %>
- </body>
- </html>
Add Comment
Please, Sign In to add comment