jsp question. (html)

Asked 2 years ago, Updated 2 years ago, 89 views

If you press the member management side on the top menu, you should see a menu called login logout membership. It's not coming out.

Can you tell me why after looking at the coding?

<%@ page language="java" contentType = "text/html; charset=utf-8" pageEncoding="UTF-8" %> <%@page import="java.io.PrintWriter" %> <%@page import="user.UserDAO" %>

<!doctype html> Web site <!-- Add bootstrap css -->

 <!-- Add custom css-->
    <link rel="stylesheet" href="./css/custom.css">
    </head>

    <body>
    <%
        String userID = null;
        if(session.getAttribute("userID")!=null) {
            userID = (String) session.getAttribute("userID");
            }

            if(userID == null) {
                PrintWriter script = response.getWriter();
                script.println("<script>");
                script.println ("alert('please log in'));
                script.println("location.href='userLogin.jsp'");
                script.println("</script>");
                script.close();
                return;
            }

    %>
        <nav class = "navbar navbar-expand-lg navbar-light bg-light">
            <a class="navbar-brand" href="index.jsp">Webpage for DB integration</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbar">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item active">
                        <a class="nav-link" href="index.jsp">main</a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" id="dropdown" data-toggle="dropdown">
                             Member management
                        </a>
                        <div class="dropdown-menu" aria-labelledby="dropdown">

                        <%
                        if(userID == null) {

                        %>

                            <a class="dropdown-item"href="userLogin.jsp">Login</a>
                            <a class="dropdown-item"href="userRegister.jsp">Membership</a>

                            <%
                            }else {
                            %>
                            <a class="dropdown-item"href="userLogout.jsp">Logout</a>
                            <%
                                }
                            %>
                        </div>
                    </li>
                </ul>
                <form action="./index.jsp" method="get" class="form-inline my-2-lg-0">
                    <input type="text" name="search" class="form-control mr-sm-2" placeholder="Enter" aria-label="Search">
                    <Button class="btn btn-outline-access my-2 my-sm-0" type="submit">search</button>
                </form>
            </div>
        </nav>

        <!-- Add J-Query JavaScript-->
        <script src="./js/jquery.min.js"></script>
        <!--Add Popper JavaScript -->
        <script src="./js/popper.min.js"></script>
        <!-- Add bootstrap JavaScript-->
        <script src="/js/bootstrap.min.js"></script>
    </body>
</html>

jsp html web

2022-09-21 21:06

1 Answers

        <script src="./js/jquery.min.js"></script>
        <script src="./js/popper.min.js"></script>
        <script src="/js/bootstrap.min.js"></script>

Check the route here. There's only one difference. If you look at the Network tab in the Developer Tool, you can check the files that you have not downloaded.


2022-09-21 21:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.