Skip to content

Commit

Permalink
about servlet documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shashirajraja authored Oct 22, 2023
1 parent 1ada9b7 commit 1709045
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/servlets/AboutServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 11,13 @@

import com.bittercode.model.UserRole;
import com.bittercode.util.StoreUtil;

//Http Servlet extended class for showing the about information
public class AboutServlet extends HttpServlet {

public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
PrintWriter pw = res.getWriter();
res.setContentType("text/html");
//If the store is logged in as customer or seller show about info
if (StoreUtil.isLoggedIn(UserRole.CUSTOMER, req.getSession())) {
RequestDispatcher rd = req.getRequestDispatcher("CustomerHome.html");
rd.include(req, res);
Expand All @@ -32,6 33,8 @@ public void service(HttpServletRequest req, HttpServletResponse res) throws IOEx
" title=\"My Personal Website\" width=\"100%\" height=\"100%\"></iframe>");

} else {
//If the user is not logged in, ask to login first
//Proceed only if logged in or forword to login page
RequestDispatcher rd = req.getRequestDispatcher("login.html");
rd.include(req, res);
pw.println("<table class=\"tab\"><tr><td>Please Login First to Continue!!</td></tr></table>");
Expand Down

0 comments on commit 1709045

Please sign in to comment.