Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
Big fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingadonis committed Dec 7, 2023
1 parent 4e60610 commit 6a7c090
Show file tree
Hide file tree
Showing 24 changed files with 257 additions and 858 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.dao.impl.mysql.CategoryDAOMySQLImpl;
import io.hardingadonis.miu.model.Category;
import io.hardingadonis.miu.services.Singleton;
import io.hardingadonis.miu.model.*;
import io.hardingadonis.miu.services.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;

@WebServlet(name = "CategoryManagement", urlPatterns = {"/categorymanagement"})
@MultipartConfig
public class CategoryManagement extends HttpServlet {
@WebServlet(name = "CategoryAdmin", urlPatterns = {"/admin/category"})
public class CategoryAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession();

request.getRequestDispatcher("/view/admin/category-management.jsp").forward(request, response);
Admin admin = (Admin) session.getAttribute("admin");

if (admin == null) {
response.sendRedirect(request.getContextPath() + "/admin/login");
return;
}

request.getRequestDispatcher("/view/admin/category-admin.jsp").forward(request, response);

}

Expand All @@ -29,7 +35,5 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.model.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;

@WebServlet(name = "DashboardAdmin", urlPatterns = {"/admin"})
public class DashboardAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession();

Admin admin = (Admin) session.getAttribute("admin");

if (admin == null) {
response.sendRedirect(request.getContextPath() + "/admin/login");
return;
}

request.getRequestDispatcher("/view/admin/dashboard-admin.jsp").forward(request, response);
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.model.Admin;
import io.hardingadonis.miu.services.Hash;
import io.hardingadonis.miu.services.Singleton;
import io.hardingadonis.miu.model.*;
import io.hardingadonis.miu.services.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.annotation.*;
import javax.servlet.http.*;

@WebServlet(name = "LoginAdmin", urlPatterns = {"/admin/login"})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.hardingadonis.miu.controller.admin;

import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;

@WebServlet(name = "LogoutAdmin", urlPatterns = {"/admin/logout"})
public class LogoutAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession(false);

if (session != null) {
session.invalidate();
}

response.sendRedirect(request.getContextPath() + "/admin");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.model.*;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;

@WebServlet(name = "OrderAdmin", urlPatterns = {"/admin/order"})
public class OrderAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession();

Admin admin = (Admin) session.getAttribute("admin");

if (admin == null) {
response.sendRedirect(request.getContextPath() + "/admin/login");
return;
}

request.getRequestDispatcher("/view/admin/order-admin.jsp").forward(request, response);
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}

}
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.services.Singleton;
import io.hardingadonis.miu.model.*;
import io.hardingadonis.miu.services.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.annotation.*;
import javax.servlet.http.*;
import org.json.simple.JSONObject;
import org.json.simple.*;

@WebServlet(name = "ProductManagement", urlPatterns = {"/productmanagement"})
public class ProductManagement extends HttpServlet {
@WebServlet(name = "ProductAdmin", urlPatterns = {"/admin/product"})
public class ProductAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession();

request.getRequestDispatcher("/view/admin/product-management.jsp").forward(request, response);
Admin admin = (Admin) session.getAttribute("admin");

if (admin == null) {
response.sendRedirect(request.getContextPath() + "/admin/login");
return;
}

request.getRequestDispatcher("/view/admin/product-admin.jsp").forward(request, response);
}

@Override
Expand Down Expand Up @@ -46,5 +56,4 @@ protected void doDelete(HttpServletRequest request, HttpServletResponse response
System.err.println(ex.getMessage());
}
}

}
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
package io.hardingadonis.miu.controller.admin;

import io.hardingadonis.miu.services.Singleton;
import java.io.IOException;
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 org.json.simple.JSONObject;

@WebServlet(name = "ListUserServlet", urlPatterns = {"/listUser"})
public class ListUserServlet extends HttpServlet {
import io.hardingadonis.miu.model.*;
import io.hardingadonis.miu.services.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;
import org.json.simple.*;

@WebServlet(name = "UserAdmin", urlPatterns = {"/admin/user"})
public class UserAdmin extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

HttpSession session = request.getSession();

Admin admin = (Admin) session.getAttribute("admin");

if (admin == null) {
response.sendRedirect(request.getContextPath() + "/admin/login");
return;
}

request.getRequestDispatcher("/view/admin/list_user.jsp").forward(request, response);
request.getRequestDispatcher("/view/admin/user-admin.jsp").forward(request, response);
}

@Override
Expand Down
Loading

0 comments on commit 6a7c090

Please sign in to comment.