Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Backbone.js 如何在多页主干应用程序中传输两页之间的链接?_Backbone.js_Backbone Routing - Fatal编程技术网

Backbone.js 如何在多页主干应用程序中传输两页之间的链接?

Backbone.js 如何在多页主干应用程序中传输两页之间的链接?,backbone.js,backbone-routing,Backbone.js,Backbone Routing,我搜索了创建多页面(如index.jsp、page1.jsp、page2.jsp等物理页面),但没有找到任何有用的内容。因此,我开始尝试自己实现 我在以下名称中创建了单独的jsp/html文件index.jsp(包含仪表板页面)、customer、page2等等。我为每个页面创建了seprate路由器,以在单个页面内路由各种视图 我创建了一个顶部菜单栏,如下所示 <ul> <li><a href='index.jsp' class="dashboard"&g

我搜索了创建多页面(如index.jsp、page1.jsp、page2.jsp等物理页面),但没有找到任何有用的内容。因此,我开始尝试自己实现

我在以下名称中创建了单独的jsp/html文件index.jsp(包含仪表板页面)、customer、page2等等。我为每个页面创建了seprate路由器,以在单个页面内路由各种视图

我创建了一个顶部菜单栏,如下所示

<ul>
    <li><a href='index.jsp' class="dashboard">Dashboard</a></li>
    <li><a href="customer.jsp">customer</a></li>
    <li><a href="page2.jsp">Page2</a></li>
    <li><a href="page3.jsp">Page3</a></li>
<ul>
<ol class="nav">
    <li><a href='index.jsp' class="dashboard">Dashboard</a></li>
    <li class="dropdown">
         <a data-toggle="dropdown" href="customer.jsp">Customer</a>
         <ul class="dropdown-menu">
             <li><a href="customer.jsp#/customer/list"> Customer List</a></li>
             <li><a href="customer.jsp#/customer/new"> New Customer</a></li>
         </ul>
    </li>
    <li><a href="page2.jsp">Page2</a></li>
    <li><a href="page3.jsp">Page3</a></li>
<ol>
当我单击那些“li”时,页面加载良好,我有两个按钮列出客户并在客户页面中创建新客户,单击这些按钮,我将路由到路由器中的customer/list(customer.jsp#customer/list)和customer/new(customer.jsp#customer/new)并加载各自的视图。到目前为止没有任何问题,我认为创建多页主干应用程序很容易

当我在顶部菜单栏中添加子菜单时,我遇到了麻烦,如下所示

<ul>
    <li><a href='index.jsp' class="dashboard">Dashboard</a></li>
    <li><a href="customer.jsp">customer</a></li>
    <li><a href="page2.jsp">Page2</a></li>
    <li><a href="page3.jsp">Page3</a></li>
<ul>
<ol class="nav">
    <li><a href='index.jsp' class="dashboard">Dashboard</a></li>
    <li class="dropdown">
         <a data-toggle="dropdown" href="customer.jsp">Customer</a>
         <ul class="dropdown-menu">
             <li><a href="customer.jsp#/customer/list"> Customer List</a></li>
             <li><a href="customer.jsp#/customer/new"> New Customer</a></li>
         </ul>
    </li>
    <li><a href="page2.jsp">Page2</a></li>
    <li><a href="page3.jsp">Page3</a></li>
<ol>

  • 麻烦你了:

    当我从index.jsp中单击Customer List时,它会完全重定向到该url并加载内容;当我从Customer List页面中单击Customer New时,url会更改,但只有当我在浏览器中单击refresh按钮时,内容才会更改

    当我先单击Customer New,然后单击Customer List页面时,情况也是如此。换句话说,第一个url重定向有效,而下面的url重定向仅在单击刷新按钮时有效

    因为我对这个充满脊梁骨的世界还不熟悉,所以我自己也无法理解。我在谷歌上搜索了一天后发布了这篇文章。有人能帮我解决这个问题吗

    在MULIT-PAGE上移动的原因(物理)


    1) 为了避免加载特定页面不需要的视图js文件(例如,Dashboard加载客户页面、page1等所需的所有视图js)。

    浏览器会缓存您的js文件,因此仅使用多个页面来避免一次加载它们不是一个好主意。相反,您应该将js文件缩小并压缩到一个单独的js文件中,该文件包含在每个页面上

    如果您使用的是maven,那么一个好的java迷你程序是


    至于为什么您的内容会发生变化,我需要查看您的js,但我的要求是使用主干开发多页应用程序。