2012-09-18 108 views
1

我的應用程序在開發過程中完美工作,但是當我將它部署到tomcat下拉菜單時停止工作。它在那裏,它在鼠標懸停下降,但它不響應鼠標點擊。我檢查了生成的鏈接和外觀很好。如果我手動輸入網址,它工作正常。我猜這是一些JavaScript /文件位置問題,但我似乎無法找到它。可能丟失了一些明顯的東西。Twitter引導下拉菜單在部署時不起作用

這是我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&hellip;"/></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它的工作原理。

+0

這裏沒有可用的代碼... –

+0

你使用什麼瀏覽器?取決於哪個JavaScript控制檯可能是一個很好的開始。 –

+0

@PraveenKumar對不起。粘貼時出錯。 – drago

回答

0

您需要擁有有效的文檔類型。確保您的.gsp和生成頁面的源代碼開頭:

<!doctype html> 
<html lang="en" xmlns="http://www.w3.org/1999/html"> 
0

變化

<script type="text/javascript" src="<g:resource dir="/js/bootstrap" file="bootstrap-dropdown.js" />"></script> 

<script type="text/javascript" src="<g:resource dir="js/bootstrap" file="bootstrap-dropdown.js" />"></script> 
0

我是新來的MVC和引導,並有這個問題,當引導3.3.5下我修改bootstrap.css恢復子類,但沒有修改bootstrap.min.css。在編譯Debug = True(web.config - > system.web)並忽略縮小文件的Dev中,所有的都很好,但是當部署到Debug = False的服務器時,縮小版本(bootstrap.min.css)重寫了我的定製版本。作爲短期修復,我刪除了生產中的bootstrap.min.css文件,但現在將調查更新縮小的.css文件。絕對是一個新秀的錯誤,但我們中有一些人,我希望這可以幫助別人。