【问题标题】:How to add a new page in Lift framework如何在 Lift 框架中添加新页面
【发布时间】:2011-02-22 15:15:05
【问题描述】:

如何在lift的webapp目录中添加用户可以访问的新页面?

目前只能通过http://localhost:8080/http://localhost:8080/index.html访问index.html

假设我在 webapp 目录中添加了一个静态文件 newpage.html,那么我该怎么做才能让用户通过http://localhost:8080/newpage.html 访问它?

【问题讨论】:

    标签: html scala url-rewriting lift


    【解决方案1】:

    我已经很久没有用 Lift 做任何事情了,但据我所知,最简单的方法可能是在 bootstrap.liftweb.Boot.scala 类的菜单条目中添加页面。如果您使用 Lift 的 maven 原型之一设置项目,则该类应该在您的项目中。在这个类中,有下面一行(或类似的东西,我得到的例子仍然使用 Lift 1.0,目前我相信他们已经朝着 2.0 版本迈进):

    
    // Build SiteMap
    val entries = Menu(Loc("Home", List("index"), "Home")) :: Nil
    

    如果您将该行更改为以下内容:

    
    val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("Welcome", List("welcome"), "Welcome")) :: Nil
    

    您可以直接访问欢迎页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多