From 767301e5b265734d72d4063013fce078f1550d06 Mon Sep 17 00:00:00 2001 From: Egor Kondrashov Date: Fri, 8 Mar 2024 15:42:56 +0400 Subject: [PATCH 1/8] add table to index.jsp --- .idea/.gitignore | 8 ++++++++ .idea/encodings.xml | 7 +++++++ .idea/misc.xml | 13 +++++++++++++ .idea/vcs.xml | 6 ++++++ src/main/webapp/index.jsp | 17 +++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..aa00ffab --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..52d39775 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 964cc071..d85a6993 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -7,6 +7,23 @@

Tic-Tac-Toe

+ + + + + + + + + + + + + + + + +
012
345
678
Tic-Tac-Toe @@ -33,14 +34,26 @@

CROSSES WIN!

+

NOUGHTS WIN!

+
From bb679a4b86277dd5b0ee60a44d13219ec3afd7a9 Mon Sep 17 00:00:00 2001 From: Egor Kondrashov Date: Fri, 8 Mar 2024 21:58:54 +0400 Subject: [PATCH 8/8] add Draw to LogicServlet. add Draw and Restart Game for index.jsp --- src/main/java/com/tictactoe/LogicServlet.java | 6 ++++++ src/main/webapp/index.jsp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/tictactoe/LogicServlet.java b/src/main/java/com/tictactoe/LogicServlet.java index 2fe0f324..f728ecfa 100644 --- a/src/main/java/com/tictactoe/LogicServlet.java +++ b/src/main/java/com/tictactoe/LogicServlet.java @@ -39,6 +39,12 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se if (checkWin(resp, currentSession, field)) { return; } + } else { + currentSession.setAttribute("draw", true); + List data = field.getFieldData(); + currentSession.setAttribute("data", data); + resp.sendRedirect("/index.jsp"); + return; } diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 53362ed8..c64393c9 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -40,6 +40,11 @@

NOUGHTS WIN!

+ +

IT'S A DRAW

+
+ +