我的应用程序在开发中运行良好,但是当我将它部署到 tomcat 下拉菜单时停止工作。它在那里,它在鼠标悬停时下降,但它对鼠标点击没有反应。我检查了生成的链接,看起来不错。如果我手动输入 URL,它可以正常工作。我猜这是一些 JavaScript/文件位置问题,但我似乎找不到它。可能遗漏了一些明显的东西。
这是我生成菜单的 main.gsp:
<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><g:layoutTitle default="Grails"/></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
<link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
<link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css">
<link rel="stylesheet" href="${resource(dir: 'css/bootstrap', file: 'bootstrap.css')}" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="<g:resource dir="/js/bootstrap" file="bootstrap-dropdown.js" />"></script>
<g:layoutHead/>
<r:layoutResources />
</head>
<body>
<div class="navbar-inner">
<a href="http://grails.org">
<img src="${resource(dir: 'images', file: 'coming.gif')}" alt="Grails"/>
</a>
<sec:ifLoggedIn>
<div id="headinfo">
<g:message code="header.user" /> : ${ sec.loggedInUserInfo(field:'username') } <br/>
<g:message code="header.date" /> : <g:formatDate date='${new Date()}' format='E, dd MMM yyyy' locale='${Locale.ENGLISH}'/> <br/>
<a href="?lang=sr"> <g:img dir="images" file="sr.gif"/> </a>
<a href="?lang=en"> <g:img dir="images" file="en.gif"/> </a>
</div>
</sec:ifLoggedIn>
<h2 id="maintitle"><g:layoutTitle default="Grails"/></h2>
</div>
<header class="jumbotron subhead" id="overview">
<div class="subnav">
<ul class="nav nav-pills" id="meni">
<li class="dropdown open">
<a href="${createLink(controller:'ticket',action:'index')}"> <g:message code="menu.home" /> </a>
</li>
<li class="dropdown open">
<g:link controller="ticket" action="list" data-toggle="dropdown"> <g:message code="menu.tickets" /> <b class="caret"></b> </g:link>
<ul class="dropdown-menu">
<li> <g:link controller="ticket" action="list" data-toggle="dropdown"> <g:message code="menu.ticketList" /> </g:link> </li>
<li> <g:link controller="ticket" action="create" data-toggle="dropdown"> <g:message code="menu.createTicket" /> </g:link> </li>
</ul>
</li>
<li class="dropdown open">
<a href="#" data-toggle="dropdown"> <g:message code="menu.admin" /> <b class="caret"></b> </a>
<ul class="dropdown-menu">
<li> <g:link controller="user" action="list" data-toggle="dropdown"> <g:message code="menu.listUsers" /> </g:link> </li>
<li> <g:link controller="company" action="list" data-toggle="dropdown"> <g:message code="menu.listCompanies" /> </g:link> </li>
<li> <g:link controller="company" action="create" data-toggle="dropdown"> <g:message code="menu.createCompany" /> </g:link> </li>
<li> <g:link controller="project" action="list" data-toggle="dropdown"> <g:message code="menu.projectsList" /> </g:link> </li>
<li> <g:link controller="project" action="create" data-toggle="dropdown"> <g:message code="menu.createProjects" /> </g:link> </li>
<li> <g:link controller="user" action="invitation" data-toggle="dropdown"> <g:message code="menu.inviteUser" /> </g:link> </li>
</ul>
</li>
<sec:ifNotLoggedIn>
<li class="dropdown open">
<g:link controller="login" action="index" data-toggle="dropdown"> <g:message code="menu.login" /> </g:link>
</li>
</sec:ifNotLoggedIn>
<sec:ifLoggedIn>
<li class="dropdown open">
<g:link controller="logout" action="index" data-toggle="dropdown"> <g:message code="menu.logout" /> </g:link>
</li>
</sec:ifLoggedIn>
</ul>
</div>
</header>
<div id="maincontent">
<g:layoutBody/>
</div>
<div class="navbar-inner" id="footerdiv">
<div id="foottext"> Help Desk </div>
</div>
<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading…"/></div>
<g:javascript library="application"/>
<r:layoutResources />
</div>
</body>
这是一个页眉:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><g:layoutTitle default="Grails"/></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
<link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
<link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css">
<link rel="stylesheet" href="${resource(dir: 'css/bootstrap', file: 'bootstrap.css')}" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="<g:resource dir="/js/bootstrap" file="bootstrap-dropdown.js" />"></script>
<g:layoutHead/>
<r:layoutResources />
</head>
提前致谢。
编辑:这是 Chrome 控制台中的唯一错误:
Failed to load resource: the server responded with a status of 403 (Forbidden) http://sg.perion.com/v1.1/js/gt.js
而且我注意到,如果我用 right_mouse_button/open_in_new_tab 打开一个下拉菜单链接,它就可以工作。