diff --git a/src/main/java/admin/AdminServlet.java b/src/main/java/admin/AdminServlet.java new file mode 100644 index 00000000..31f14dd5 --- /dev/null +++ b/src/main/java/admin/AdminServlet.java @@ -0,0 +1,79 @@ + +package admin; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class AdminServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + /* TODO output your page here. You may use following sample code. */ + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet AdminServlet"); + out.println(""); + out.println(""); + out.println("

Servlet AdminServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/main/java/admin/ListOrderServlet.java b/src/main/java/admin/ListOrderServlet.java new file mode 100644 index 00000000..31b3ad7d --- /dev/null +++ b/src/main/java/admin/ListOrderServlet.java @@ -0,0 +1,79 @@ + +package admin; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class ListOrderServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + /* TODO output your page here. You may use following sample code. */ + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet ListOrderServlet"); + out.println(""); + out.println(""); + out.println("

Servlet ListOrderServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/main/java/admin/ListUserServlet.java b/src/main/java/admin/ListUserServlet.java new file mode 100644 index 00000000..a7270e76 --- /dev/null +++ b/src/main/java/admin/ListUserServlet.java @@ -0,0 +1,79 @@ + +package admin; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class ListUserServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + /* TODO output your page here. You may use following sample code. */ + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet ListUserServlet"); + out.println(""); + out.println(""); + out.println("

Servlet ListUserServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 40cdddd7..a6319c95 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -8,6 +8,30 @@ DefaultFilter /* + + AdminServlet + admin.AdminServlet + + + ListUserServlet + admin.ListUserServlet + + + ListOrderServlet + admin.ListOrderServlet + + + AdminServlet + /admin + + + ListUserServlet + /listUser + + + ListOrderServlet + /listOrder + 15 diff --git a/src/main/webapp/assets/css/admin/admin.css b/src/main/webapp/assets/css/admin/admin.css new file mode 100644 index 00000000..6736071b --- /dev/null +++ b/src/main/webapp/assets/css/admin/admin.css @@ -0,0 +1,9 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template +*/ +/* + Created on : Dec 6, 2023, 1:59:18 PM + Author : LENOVO +*/ + diff --git a/src/main/webapp/assets/css/admin/styles.css b/src/main/webapp/assets/css/admin/styles.css new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/main/webapp/assets/css/admin/styles.css @@ -0,0 +1 @@ + diff --git a/src/main/webapp/view/admin/loginAdmin.jsp b/src/main/webapp/view/admin/admin.jsp similarity index 72% rename from src/main/webapp/view/admin/loginAdmin.jsp rename to src/main/webapp/view/admin/admin.jsp index 104d9ad4..b7b4726f 100644 --- a/src/main/webapp/view/admin/loginAdmin.jsp +++ b/src/main/webapp/view/admin/admin.jsp @@ -1,8 +1,4 @@ -<%-- - Document : loginAdmin - Created on : Dec 5, 2023, 3:51:38 PM - Author : LENOVO ---%> + <%@page contentType="text/html" pageEncoding="UTF-8"%> diff --git a/src/main/webapp/view/admin/list_order.jsp b/src/main/webapp/view/admin/list_order.jsp new file mode 100644 index 00000000..b7b4726f --- /dev/null +++ b/src/main/webapp/view/admin/list_order.jsp @@ -0,0 +1,13 @@ + + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

Hello World!

+ + diff --git a/src/main/webapp/view/admin/list_user.jsp b/src/main/webapp/view/admin/list_user.jsp new file mode 100644 index 00000000..b7b4726f --- /dev/null +++ b/src/main/webapp/view/admin/list_user.jsp @@ -0,0 +1,13 @@ + + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

Hello World!

+ +