0
不工作我有有一個像下拉菜單中引導
<ul class="nav navbar-nav navbar-right">
\t \t \t \t <li class="dropdown">
\t \t \t \t \t <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
\t \t \t \t \t \t <c:out value="${pageContext.request.remoteUser}"/>
\t \t \t \t \t \t <span class="caret"></span>
\t \t \t \t \t </a>
\t \t \t \t \t <ul class="dropdown-menu" role="menu">
\t \t \t \t \t \t <li>
\t \t \t \t \t \t \t <a href="#" onclick="document.getElementById('logout-form').submit();">Logout</a> \t
\t \t \t \t \t \t </li>
\t \t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t </ul>
現在,當我點擊下拉菜單,而不是向我展示選項的導航欄網頁註銷沒有任何反應,它只是附加一個「#」的URL。例如,美元是http://localhost:8080/index
它變成http://localhost:8080/index#
。我怎樣才能避免這種
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<nav class="navbar navbar-default navbar-static-top">
\t \t <div class="container-fluid">
\t \t \t <!-- Brand and toggle get grouped for better mobile display -->
\t \t <div class="navbar-header">
\t \t \t <button type="button" class="navbar-toggle collapsed"
\t \t \t \t data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
\t \t \t \t <span class="sr-only">Toggle navigation</span> <span
\t \t \t \t \t class="icon-bar"></span> <span class="icon-bar"></span> <span
\t \t \t \t \t class="icon-bar"></span>
\t \t \t </button>
\t \t \t <a class="navbar-brand" href="#"><img src="/static/images/Snapdeal.png"></a>
\t \t </div>
\t \t <!-- Collect the nav links, forms, and other content for toggling
\t \t <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /> -->
\t \t <form id="logout-form" class="form-inline" action="/logout" style="display: none">
\t \t \t <input type="submit" value="Logout" class="btn btn-link" />
\t \t \t
\t \t </form>
\t \t <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
\t \t \t <h3 class="navbar-text"><b>Crux Admin</b></h3>
\t \t \t <ul class="nav navbar-nav">
\t \t \t \t <c:choose>
\t \t \t \t \t <c:when test="${param.currentPage eq 'dashboard'}">
\t \t \t \t \t \t <c:set var="classValue" value="active" />
\t \t \t \t \t </c:when>
\t \t \t \t \t <c:otherwise>
\t \t \t \t \t \t <c:set var="classValue" value="" />
\t \t \t \t \t </c:otherwise>
\t \t \t \t </c:choose>
\t \t \t \t <li class="${classValue}"><a href="/index">Dashboard</a></li>
\t \t \t </ul>
\t \t \t
\t \t \t
\t \t \t <ul class="nav navbar-nav navbar-right">
\t \t \t \t <li class="dropdown">
\t \t \t \t \t <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
\t \t \t \t \t \t <c:out value="${pageContext.request.remoteUser}"/>
\t \t \t \t \t \t <span class="caret"></span>
\t \t \t \t \t </a>
\t \t \t \t \t <ul class="dropdown-menu" role="menu">
\t \t \t \t \t \t <li>
\t \t \t \t \t \t \t <a href="#" onclick="document.getElementById('logout-form').submit();">Logout</a> \t
\t \t \t \t \t \t </li>
\t \t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t </ul>
\t \t </div>
\t \t <!-- /.navbar-collapse -->
\t </div>
\t <!-- /.container-fluid -->
</nav>
你有ID的元素' #logout-form'在你的頁面上?您沒有提供足夠的代碼來重現您描述的問題。 – Serlite
@Serlite我已把整個頁面 –
忽略此,評論,它不會讓我刪除它 – njfife