Доброй ночи, подскажите пожалуйста как решить проблему. Есть у меня две jsp страницы, одна это боковая панель и хедер с поиском, вторая это список компаний. Вторая страница подтягивает первую.
При нажатии на выпадающее меню оно сразу закрывается. Как это устранить?
Хочу добавить, если с первой страницы (по тексту ниже) убрать
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.min.js" ></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
и в конец страницы добавить
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
то выпадающее меню работает нормально, но автозаполнение в поиске перестает работать
код страниц:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<%@ page session="false" %>
<html>
<head>
<title>Company</title>
<link rel="stylesheet/less" type="text/css" href="/resources/css/style.less"/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/less.js/2.5.0/less.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<link href="${contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.min.js" ></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<jsp:include page="../menuPices/navbarLeft.jsp"/>
<div class="main-content">
<h1>Companies</h1>
<a href="<c:url value='/company/add/' />" class="btn btn-lg"><i class="fa fa-plus"></i>
Create company</a>
</br>
</br>
<c:if test="${!empty listCompanies}">
<table class="table table-striped table-condensed">
<tr>
<th class="text-center" width="23">ID</th>
<th class="text-center" width="120">Name</th>
<th class="text-center" width="80">Email</th>
<th class="text-center" width="80">Web site</th>
<th class="text-center" width="60">Address</th>
<th class="text-center" width="40">Created</th>
<th class="text-center" width="40">Updated</th>
<th class="text-center" width="50">Details</th>
<th class="text-center" width="50">Edit</th>
<th class="text-center" width="50">Delete</th>
</tr>
<c:forEach items="${listCompanies}" var="company">
<tr>
<td>${company.id}</td>
<td>${company.name}</td>
<td>${company.email}</td>
<td>${company.website}</td>
<td>${company.address}</td>
<td><fmt:formatDate value="${company.created}" pattern="d-MM-yyyy, HH:mm:ss"/></td>
<td><fmt:formatDate value="${company.updated}" pattern="d-MM-yyyy, HH:mm:ss"/></td>
<td class="text-center"><a href="<c:url value='/companydata/${company.id}/' />"
span class="glyphicon glyphicon glyphicon-file "
style="color: darkblue"/></td>
<td class="text-center"><a href="<c:url value='/editcompany/${company.id}/' />"
span class="glyphicon glyphicon glyphicon-edit"
style="color: orange"/></td>
<td class="text-center"><a href="<c:url value='/removecompany/${company.id}/' />"
span class="glyphicon glyphicon-remove" style="color: red"/></td>
</tr>
</c:forEach>
</table>
</c:if>
</div>
<script type="text/javascript">
$(function() {
$('#acInput').autocomplete({
source: function (request, response) {
$.getJSON("/companySearch/", {
term: request.term
}, response);
}
});
});
</script>
<script src="${contextPath}/resources/js/bootstrap.min.js"></script>
<script src="${contextPath}/resources/js/main.js"></script>
</body>
</html>
Вторая:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<%@ page session="false" %>
<script src="${contextPath}/resources/js/main.js"></script>
<div id="main-wrapper"/>
<div class="left-sidebar">
<div class="navbar-toggle"><i class="fa fa-bars"></i></div>
<div class="nav-block">
<div class="menu-content">
<div class="content">
<div class="sidebar-logo">
<a href="#"></a>
</div>
<ul class="left-navigation">
<li class="active" >
<a href="index.html"><i class="glyphicon glyphicon-home"></i><span>Main Page</span></a></li>
<li><a href="<c:url value='/home/' />"><i class="glyphicon glyphicon-user"></i><span>My account</span></a></li>
<li class="parent"><a href="#"><i class="fa fa-angle-down"></i><span>Company</span></a>
<ul class="sub-menu"><li><a href="<c:url value='/company/' />"><i class="glyphicon glyphicon-credit-card"></i> All Company</a></li></ul>
<ul class="sub-menu"><li><a href="<c:url value='/company/add/' />"><i class="glyphicon glyphicon-plus"></i> Create</a></li></ul>
</li>
</ul>
</div>
</div>
</div>
<script src="${contextPath}/resources/js/main.js"></script>
</div>
<nav class="nav" style="background-color: #203745">
<div class="container-fluid">
<form class="navbar-form navbar-left">
<div class="form-group">
<form:form method="GET" action="/company/">
<input name="name" id="acInput" class="form-control" placeholder="search..." size="60" maxlength="90" style="width: 400px; height: 30px;">
<button type="submit">
<spring:message text="Add"/>
</button>
</form:form>
</div>
</form>
<form class="navbar-form navbar-right">
<div class style="color: #66afe9">
<a href="<%=request.getContextPath()%>?languageVar=en"><spring:message code="general.EN"/></a>
<a href="<%=request.getContextPath()%>?languageVar=ru"><spring:message code="general.RU"/></a>
</div>
</form>
</div>
</nav>