test

Форк
1
/
AboutServlet.java 
42 строки · 1.7 Кб
1
package servlets;
2

3
import java.io.IOException;
4
import java.io.PrintWriter;
5

6
import javax.servlet.RequestDispatcher;
7
import javax.servlet.ServletException;
8
import javax.servlet.http.HttpServlet;
9
import javax.servlet.http.HttpServletRequest;
10
import javax.servlet.http.HttpServletResponse;
11

12
import com.bittercode.model.UserRole;
13
import com.bittercode.util.StoreUtil;
14

15
public class AboutServlet extends HttpServlet {
16

17
    public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
18
        PrintWriter pw = res.getWriter();
19
        res.setContentType("text/html");
20
        if (StoreUtil.isLoggedIn(UserRole.CUSTOMER, req.getSession())) {
21
            RequestDispatcher rd = req.getRequestDispatcher("CustomerHome.html");
22
            rd.include(req, res);
23
            StoreUtil.setActiveTab(pw, "about");
24
            pw.println("<iframe src=\"https://flowcv.me/shashirajraja\" class=\"holds-the-iframe\"\r\n"
25
                    + "        title=\"My Personal Website\" width=\"100%\" height=\"100%\"></iframe>");
26

27
        } else if (StoreUtil.isLoggedIn(UserRole.SELLER, req.getSession())) {
28
            RequestDispatcher rd = req.getRequestDispatcher("SellerHome.html");
29
            rd.include(req, res);
30
            StoreUtil.setActiveTab(pw, "about");
31
            pw.println("<iframe src=\"https://flowcv.me/shashirajraja\" class=\"holds-the-iframe\"\r\n"
32
                    + "        title=\"My Personal Website\" width=\"100%\" height=\"100%\"></iframe>");
33

34
        } else {
35
            RequestDispatcher rd = req.getRequestDispatcher("login.html");
36
            rd.include(req, res);
37
            pw.println("<table class=\"tab\"><tr><td>Please Login First to Continue!!</td></tr></table>");
38
        }
39

40
    }
41

42
}
43

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.