From d4c995f0d1e8a42f3f756d857ec7a35f565a91ae Mon Sep 17 00:00:00 2001 From: siyoon Date: Mon, 13 Jul 2020 23:10:12 +0900 Subject: [PATCH 01/15] =?UTF-8?q?UpdateUserFormServlet=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/next/web/UpdateUserFormServlet.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/next/web/UpdateUserFormServlet.java diff --git a/src/main/java/next/web/UpdateUserFormServlet.java b/src/main/java/next/web/UpdateUserFormServlet.java new file mode 100644 index 000000000..8e09c9d59 --- /dev/null +++ b/src/main/java/next/web/UpdateUserFormServlet.java @@ -0,0 +1,26 @@ +package next.web; + +import core.db.DataBase; +import next.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +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 java.io.IOException; + +@WebServlet("/user/update/*") +public class UpdateUserFormServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(UpdateUserFormServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + final RequestDispatcher requestDispatcher = req.getRequestDispatcher("/user/update.jsp"); + requestDispatcher.forward(req, resp); + } +} From 1dfb920ad968c97bf5c5170eb153ae794b4eb9ac Mon Sep 17 00:00:00 2001 From: siyoon Date: Mon, 13 Jul 2020 23:10:49 +0900 Subject: [PATCH 02/15] =?UTF-8?q?update.jsp=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/user/update.jsp | 104 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 webapp/user/update.jsp diff --git a/webapp/user/update.jsp b/webapp/user/update.jsp new file mode 100644 index 000000000..b1cf2832c --- /dev/null +++ b/webapp/user/update.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + + + SLiPP Java Web Programming + + + + + + + + + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ + + + + + + \ No newline at end of file From f1ce5019ad3c9b17468bcb1485d696c1597b5433 Mon Sep 17 00:00:00 2001 From: siyoon Date: Tue, 14 Jul 2020 09:08:21 +0900 Subject: [PATCH 03/15] =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=EC=97=90=20userId=EB=A5=BC=20path=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/model/User.java | 9 +++++++++ src/main/java/next/web/UpdateUserFormServlet.java | 4 ++++ webapp/user/list.jsp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/next/model/User.java b/src/main/java/next/model/User.java index c3413b42a..2b2375bdb 100644 --- a/src/main/java/next/model/User.java +++ b/src/main/java/next/model/User.java @@ -66,4 +66,13 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + return "User{" + + "userId='" + userId + '\'' + + ", password='" + password + '\'' + + ", name='" + name + '\'' + + ", email='" + email + '\'' + + '}'; + } } diff --git a/src/main/java/next/web/UpdateUserFormServlet.java b/src/main/java/next/web/UpdateUserFormServlet.java index 8e09c9d59..3f3d9c6ce 100644 --- a/src/main/java/next/web/UpdateUserFormServlet.java +++ b/src/main/java/next/web/UpdateUserFormServlet.java @@ -20,6 +20,10 @@ public class UpdateUserFormServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + final String userId = req.getPathInfo().substring(1); + log.info("User ID : {}", userId); + final User user = DataBase.findUserById(userId); + log.info("User : {}", user.toString()); final RequestDispatcher requestDispatcher = req.getRequestDispatcher("/user/update.jsp"); requestDispatcher.forward(req, resp); } diff --git a/webapp/user/list.jsp b/webapp/user/list.jsp index 74f79ded0..2d90c6f7f 100644 --- a/webapp/user/list.jsp +++ b/webapp/user/list.jsp @@ -85,7 +85,7 @@ ${user.userId} ${user.name} ${user.email} - 수정 + 수정 From 941d63b30c48001e11ee5a31e4d86f79de429f24 Mon Sep 17 00:00:00 2001 From: siyoon Date: Tue, 14 Jul 2020 09:12:07 +0900 Subject: [PATCH 04/15] =?UTF-8?q?update=20=ED=8F=BC=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20=EC=9C=A0=EC=A0=80=EC=A0=95=EB=B3=B4=20=EC=82=BD?= =?UTF-8?q?=EC=9E=85=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/UpdateUserFormServlet.java | 1 + webapp/user/update.jsp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/next/web/UpdateUserFormServlet.java b/src/main/java/next/web/UpdateUserFormServlet.java index 3f3d9c6ce..d116a6dec 100644 --- a/src/main/java/next/web/UpdateUserFormServlet.java +++ b/src/main/java/next/web/UpdateUserFormServlet.java @@ -24,6 +24,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se log.info("User ID : {}", userId); final User user = DataBase.findUserById(userId); log.info("User : {}", user.toString()); + req.setAttribute("user", user); final RequestDispatcher requestDispatcher = req.getRequestDispatcher("/user/update.jsp"); requestDispatcher.forward(req, resp); } diff --git a/webapp/user/update.jsp b/webapp/user/update.jsp index b1cf2832c..bf1adc840 100644 --- a/webapp/user/update.jsp +++ b/webapp/user/update.jsp @@ -75,19 +75,19 @@
- +
- +
- +
- +
From 716fc64424aed04ab0ceef7d37dc56caa54ef232 Mon Sep 17 00:00:00 2001 From: siyoon Date: Tue, 14 Jul 2020 09:49:33 +0900 Subject: [PATCH 05/15] =?UTF-8?q?HttpServletRequest=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=83=9D=EC=84=B1=ED=95=98=EA=B3=A0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=98=EB=8A=94=20=EC=B6=94=EC=83=81?= =?UTF-8?q?=ED=99=94=ED=95=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/model/User.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/next/model/User.java b/src/main/java/next/model/User.java index 2b2375bdb..d5f5bb81a 100644 --- a/src/main/java/next/model/User.java +++ b/src/main/java/next/model/User.java @@ -1,5 +1,7 @@ package next.model; +import javax.servlet.http.HttpServletRequest; + public class User { private String userId; private String password; @@ -13,6 +15,19 @@ public User(String userId, String password, String name, String email) { this.email = email; } + public User(HttpServletRequest req) { + this.userId = req.getParameter("userId"); + this.password = req.getParameter("password"); + this.name = req.getParameter("name"); + this.email = req.getParameter("email"); + } + + public void modifyInfo(HttpServletRequest req) { + this.password = req.getParameter("password"); + this.name = req.getParameter("name"); + this.email = req.getParameter("email"); + } + public String getUserId() { return userId; } From e2ac95fd4ebcc23398e5267540805212df28192e Mon Sep 17 00:00:00 2001 From: siyoon Date: Tue, 14 Jul 2020 09:51:10 +0900 Subject: [PATCH 06/15] =?UTF-8?q?user=20=EC=83=9D=EC=84=B1=EC=8B=9C?= =?UTF-8?q?=EC=97=90=20=EC=8B=9C=EA=B7=B8=EB=8B=88=EC=B2=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/CreateUserServlet.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/next/web/CreateUserServlet.java b/src/main/java/next/web/CreateUserServlet.java index 3260088da..48f737910 100644 --- a/src/main/java/next/web/CreateUserServlet.java +++ b/src/main/java/next/web/CreateUserServlet.java @@ -22,8 +22,7 @@ public class CreateUserServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - User user = new User(req.getParameter("userId"), req.getParameter("password"), req.getParameter("name"), - req.getParameter("email")); + User user = new User(req); log.debug("user : {}", user); DataBase.addUser(user); resp.sendRedirect("/user/list"); From aa2e9fecaddf90f964d26c74f4f28759a2009e04 Mon Sep 17 00:00:00 2001 From: siyoon Date: Tue, 14 Jul 2020 09:51:24 +0900 Subject: [PATCH 07/15] =?UTF-8?q?update=20=ED=8F=BC=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=A0=95=EB=B3=B4=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/UpdateUserServlet.java | 36 +++++++++++++++++++ webapp/user/update.jsp | 9 ++--- 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/main/java/next/web/UpdateUserServlet.java diff --git a/src/main/java/next/web/UpdateUserServlet.java b/src/main/java/next/web/UpdateUserServlet.java new file mode 100644 index 000000000..6ef6ceea8 --- /dev/null +++ b/src/main/java/next/web/UpdateUserServlet.java @@ -0,0 +1,36 @@ +package next.web; + +import core.db.DataBase; +import next.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +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 java.io.IOException; +import java.util.Objects; + +@WebServlet("/user/update") +public class UpdateUserServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(UpdateUserServlet.class); + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + final String userId = req.getParameter("userId"); + final User user = DataBase.findUserById(userId); + + resp.sendRedirect("/user/list"); + + if (Objects.isNull(user)) { + log.info("Can't find user By userId"); + return; + } + + user.modifyInfo(req); + } +} diff --git a/webapp/user/update.jsp b/webapp/user/update.jsp index bf1adc840..7ad0f8866 100644 --- a/webapp/user/update.jsp +++ b/webapp/user/update.jsp @@ -72,11 +72,8 @@
- -
- - -
+ +
@@ -89,7 +86,7 @@
- +
From 548de805090fd97d917f0b4167fd619b30da0c03 Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 06:48:46 +0900 Subject: [PATCH 08/15] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=B1?= =?UTF-8?q?=EA=B3=B5=EC=8B=9C=EC=97=90=20=EC=84=B8=EC=85=98=EC=97=90=20'us?= =?UTF-8?q?er'=20=EB=8B=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/UserLoginServlet.java | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/java/next/web/UserLoginServlet.java diff --git a/src/main/java/next/web/UserLoginServlet.java b/src/main/java/next/web/UserLoginServlet.java new file mode 100644 index 000000000..d447cd8cf --- /dev/null +++ b/src/main/java/next/web/UserLoginServlet.java @@ -0,0 +1,38 @@ +package next.web; + +import core.db.DataBase; +import next.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +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 javax.servlet.http.HttpSession; +import java.io.IOException; +import java.util.Objects; + +@WebServlet("/user/login") +public class UserLoginServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(UserLoginServlet.class); + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + final String userId = req.getParameter("userId"); + final String password = req.getParameter("password"); + + final User user = DataBase.findUserById(userId); + + if (user != null && user.getPassword().equals(password)) { + HttpSession session = req.getSession(); + session. setAttribute("user", user); + } + + final RequestDispatcher rd = req.getRequestDispatcher("/user/list.jsp"); + rd.forward(req, resp); + } +} From d55cd7c977375a899567c30e57c8c94baf7f7829 Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:14:21 +0900 Subject: [PATCH 09/15] =?UTF-8?q?html=ED=8C=8C=EC=9D=BC=20jsp=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD,=20nav=20=EC=A4=91=EB=B3=B5=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/{index.html => index.jsp} | 71 +++----------------- webapp/nav/nav.jsp | 64 ++++++++++++++++++ webapp/qna/form.html | 97 --------------------------- webapp/qna/form.jsp | 48 ++++++++++++++ webapp/qna/{show.html => show.jsp} | 59 ++--------------- webapp/user/form.html | 101 ----------------------------- webapp/user/form.jsp | 52 +++++++++++++++ webapp/user/list.jsp | 54 +-------------- webapp/user/login.html | 93 -------------------------- webapp/user/login.jsp | 41 ++++++++++++ webapp/user/login_failed.html | 94 --------------------------- webapp/user/login_failed.jsp | 42 ++++++++++++ webapp/user/profile.html | 97 --------------------------- webapp/user/profile.jsp | 45 +++++++++++++ webapp/user/update.jsp | 54 +-------------- 15 files changed, 308 insertions(+), 704 deletions(-) rename webapp/{index.html => index.jsp} (63%) create mode 100644 webapp/nav/nav.jsp delete mode 100644 webapp/qna/form.html create mode 100644 webapp/qna/form.jsp rename webapp/qna/{show.html => show.jsp} (73%) delete mode 100644 webapp/user/form.html create mode 100644 webapp/user/form.jsp delete mode 100644 webapp/user/login.html create mode 100644 webapp/user/login.jsp delete mode 100644 webapp/user/login_failed.html create mode 100644 webapp/user/login_failed.jsp delete mode 100644 webapp/user/profile.html create mode 100644 webapp/user/profile.jsp diff --git a/webapp/index.html b/webapp/index.jsp similarity index 63% rename from webapp/index.html rename to webapp/index.jsp index b81541763..eae99e71c 100644 --- a/webapp/index.html +++ b/webapp/index.jsp @@ -1,3 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + @@ -12,63 +15,7 @@ - - + <%@ include file="./nav/nav.jsp" %>
@@ -78,12 +25,12 @@
- 국내에서 Ruby on Rails와 Play가 활성화되기 힘든 이유는 뭘까? + 국내에서 Ruby on Rails와 Play가 활성화되기 힘든 이유는 뭘까?
2016-01-15 18:47 - 자바지기 + 자바지기
@@ -96,12 +43,12 @@ diff --git a/webapp/nav/nav.jsp b/webapp/nav/nav.jsp new file mode 100644 index 000000000..2caa1dc98 --- /dev/null +++ b/webapp/nav/nav.jsp @@ -0,0 +1,64 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + diff --git a/webapp/qna/form.html b/webapp/qna/form.html deleted file mode 100644 index a273be263..000000000 --- a/webapp/qna/form.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - SLiPP Java Web Programming - - - - - - - - - -
-
-
-
-
- - -
-
- - -
-
- - -
- -
- -
-
-
- - - - - - - \ No newline at end of file diff --git a/webapp/qna/form.jsp b/webapp/qna/form.jsp new file mode 100644 index 000000000..607e4448a --- /dev/null +++ b/webapp/qna/form.jsp @@ -0,0 +1,48 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + + + SLiPP Java Web Programming + + + + + + +<%@ include file="../nav/nav.jsp" %> + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ + + + + + + \ No newline at end of file diff --git a/webapp/qna/show.html b/webapp/qna/show.jsp similarity index 73% rename from webapp/qna/show.html rename to webapp/qna/show.jsp index bfa5a7b64..ea36402b1 100644 --- a/webapp/qna/show.html +++ b/webapp/qna/show.jsp @@ -1,3 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + @@ -12,59 +15,7 @@ - - +<%@ include file="../nav/nav.jsp" %>
@@ -102,7 +53,7 @@

InitializingBean implements afterPropertiesSet() 호출되
  • - 목록 + 목록
  • diff --git a/webapp/user/form.html b/webapp/user/form.html deleted file mode 100644 index a6ab3817a..000000000 --- a/webapp/user/form.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - SLiPP Java Web Programming - - - - - - - - - -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    - -
    - -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/webapp/user/form.jsp b/webapp/user/form.jsp new file mode 100644 index 000000000..76a590474 --- /dev/null +++ b/webapp/user/form.jsp @@ -0,0 +1,52 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + + + SLiPP Java Web Programming + + + + + + +<%@ include file="../nav/nav.jsp" %> + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/webapp/user/list.jsp b/webapp/user/list.jsp index 2d90c6f7f..ab794a09f 100644 --- a/webapp/user/list.jsp +++ b/webapp/user/list.jsp @@ -15,59 +15,7 @@ - - +<%@ include file="../nav/nav.jsp" %>
    diff --git a/webapp/user/login.html b/webapp/user/login.html deleted file mode 100644 index f2aa34d26..000000000 --- a/webapp/user/login.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - SLiPP Java Web Programming - - - - - - - - - -
    -
    -
    -
    -
    - - -
    -
    - - -
    - -
    - -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/webapp/user/login.jsp b/webapp/user/login.jsp new file mode 100644 index 000000000..15cba1cb3 --- /dev/null +++ b/webapp/user/login.jsp @@ -0,0 +1,41 @@ + + + + + + SLiPP Java Web Programming + + + + + + +<%@ include file="../nav/nav.jsp" %> + +
    +
    +
    +
    +
    + + +
    +
    + + +
    + +
    + +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/webapp/user/login_failed.html b/webapp/user/login_failed.html deleted file mode 100644 index 4aff6d9f2..000000000 --- a/webapp/user/login_failed.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - SLiPP Java Web Programming - - - - - - - - - -
    -
    -
    - -
    -
    - - -
    -
    - - -
    - -
    - -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/webapp/user/login_failed.jsp b/webapp/user/login_failed.jsp new file mode 100644 index 000000000..2054933e2 --- /dev/null +++ b/webapp/user/login_failed.jsp @@ -0,0 +1,42 @@ + + + + + + SLiPP Java Web Programming + + + + + + +<%@ include file="../nav/nav.jsp" %> + +
    +
    +
    + +
    +
    + + +
    +
    + + +
    + +
    + +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/webapp/user/profile.html b/webapp/user/profile.html deleted file mode 100644 index e0361aeb4..000000000 --- a/webapp/user/profile.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - SLiPP Java Web Programming - - - - - - - - - -
    -
    -
    -

    Profiles

    -
    -
    -
    - - - -
    -

    자바지기

    -

    -  javajigi@slipp.net -

    -
    -
    -
    -
    -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/webapp/user/profile.jsp b/webapp/user/profile.jsp new file mode 100644 index 000000000..1612c3b6e --- /dev/null +++ b/webapp/user/profile.jsp @@ -0,0 +1,45 @@ + + + + + + SLiPP Java Web Programming + + + + + + +<%@ include file="../nav/nav.jsp" %> + +
    +
    +
    +

    Profiles

    +
    +
    +
    + + + +
    +

    자바지기

    +

    +  javajigi@slipp.net +

    +
    +
    +
    +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/webapp/user/update.jsp b/webapp/user/update.jsp index 7ad0f8866..6db936e51 100644 --- a/webapp/user/update.jsp +++ b/webapp/user/update.jsp @@ -15,59 +15,7 @@ - - +<%@ include file="../nav/nav.jsp" %>
    From 3ccf547acea1c891e539f9a087d3b6c91f9f83ed Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:14:56 +0900 Subject: [PATCH 10/15] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=B1?= =?UTF-8?q?=EA=B3=B5=EC=8B=9C=EC=97=90=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=ED=8F=AC=EC=9B=8C?= =?UTF-8?q?=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/UserLoginServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/next/web/UserLoginServlet.java b/src/main/java/next/web/UserLoginServlet.java index d447cd8cf..e7ab5f160 100644 --- a/src/main/java/next/web/UserLoginServlet.java +++ b/src/main/java/next/web/UserLoginServlet.java @@ -32,7 +32,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S session. setAttribute("user", user); } - final RequestDispatcher rd = req.getRequestDispatcher("/user/list.jsp"); + final RequestDispatcher rd = req.getRequestDispatcher("/user/index.jsp"); rd.forward(req, resp); } } From 8b811de771dad29d50622a7d4d33ecbe9d913b99 Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:19:49 +0900 Subject: [PATCH 11/15] =?UTF-8?q?(=EB=88=84=EB=9D=BD=EB=90=9C=20jsp=20?= =?UTF-8?q?=ED=94=84=EB=A6=AC=ED=94=BD=EC=8A=A4=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/user/login.jsp | 3 +++ webapp/user/login_failed.jsp | 3 +++ webapp/user/profile.jsp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/webapp/user/login.jsp b/webapp/user/login.jsp index 15cba1cb3..17daac7c0 100644 --- a/webapp/user/login.jsp +++ b/webapp/user/login.jsp @@ -1,3 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + diff --git a/webapp/user/login_failed.jsp b/webapp/user/login_failed.jsp index 2054933e2..387ec911d 100644 --- a/webapp/user/login_failed.jsp +++ b/webapp/user/login_failed.jsp @@ -1,3 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + diff --git a/webapp/user/profile.jsp b/webapp/user/profile.jsp index 1612c3b6e..159fcc3d6 100644 --- a/webapp/user/profile.jsp +++ b/webapp/user/profile.jsp @@ -1,3 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + From 924700e846c8bb094b85ada43e6a3c440bd0409c Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:23:06 +0900 Subject: [PATCH 12/15] =?UTF-8?q?=EC=9C=A0=EC=A0=80=EC=83=9D=EC=84=B1,=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=8B=9C=EC=97=90=20=EC=9D=B8?= =?UTF-8?q?=EB=8D=B1=EC=8A=A4=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/CreateUserServlet.java | 2 +- src/main/java/next/web/UserLoginServlet.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/next/web/CreateUserServlet.java b/src/main/java/next/web/CreateUserServlet.java index 48f737910..864f6ed9a 100644 --- a/src/main/java/next/web/CreateUserServlet.java +++ b/src/main/java/next/web/CreateUserServlet.java @@ -25,6 +25,6 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S User user = new User(req); log.debug("user : {}", user); DataBase.addUser(user); - resp.sendRedirect("/user/list"); + resp.sendRedirect("/"); } } diff --git a/src/main/java/next/web/UserLoginServlet.java b/src/main/java/next/web/UserLoginServlet.java index e7ab5f160..4200eb224 100644 --- a/src/main/java/next/web/UserLoginServlet.java +++ b/src/main/java/next/web/UserLoginServlet.java @@ -32,7 +32,6 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S session. setAttribute("user", user); } - final RequestDispatcher rd = req.getRequestDispatcher("/user/index.jsp"); - rd.forward(req, resp); + resp.sendRedirect("/"); } } From 27fb59fb50213cc415a88abeebc8e0df65edef7e Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:23:22 +0900 Subject: [PATCH 13/15] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EC=84=9C=EB=B8=94=EB=A6=BF=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/next/web/UserLogoutServlet.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/next/web/UserLogoutServlet.java diff --git a/src/main/java/next/web/UserLogoutServlet.java b/src/main/java/next/web/UserLogoutServlet.java new file mode 100644 index 000000000..164a2815e --- /dev/null +++ b/src/main/java/next/web/UserLogoutServlet.java @@ -0,0 +1,28 @@ +package next.web; + +import core.db.DataBase; +import next.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +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 javax.servlet.http.HttpSession; +import java.io.IOException; + +@WebServlet("/user/logout") +public class UserLogoutServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(UserLogoutServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + final HttpSession session = req.getSession(); + session.removeAttribute("user"); + resp.sendRedirect("/"); + } +} From 81fefd411c04aee98b3058c0e0f0671ec29c4158 Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:26:03 +0900 Subject: [PATCH 14/15] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83,=20?= =?UTF-8?q?=EA=B0=9C=EC=9D=B8=EC=A0=95=EB=B3=B4=20=EC=88=98=EC=A0=95=20hre?= =?UTF-8?q?f=20=EC=A3=BC=EC=86=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/nav/nav.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/nav/nav.jsp b/webapp/nav/nav.jsp index 2caa1dc98..9ce634e43 100644 --- a/webapp/nav/nav.jsp +++ b/webapp/nav/nav.jsp @@ -48,8 +48,8 @@
  • Posts
  • -
  • 로그아웃
  • -
  • 개인정보수정
  • +
  • 로그아웃
  • +
  • 개인정보수정
  • 로그인
  • From 21293b2a8604c1cd1abb420ed6ee1ecfe479d5e1 Mon Sep 17 00:00:00 2001 From: siyoon Date: Wed, 15 Jul 2020 07:34:04 +0900 Subject: [PATCH 15/15] =?UTF-8?q?update.jsp=20css=EA=B0=80=20=EB=82=98?= =?UTF-8?q?=EC=98=A4=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update.jsp css 주소를 상대주소가 아닌 jsp 컨텍스트 패쓰로 설정 --- webapp/user/update.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/user/update.jsp b/webapp/user/update.jsp index 6db936e51..195b8632c 100644 --- a/webapp/user/update.jsp +++ b/webapp/user/update.jsp @@ -8,11 +8,11 @@ SLiPP Java Web Programming - + - + <%@ include file="../nav/nav.jsp" %>