开发者

How to add a new page in Lift framework

How can I add a new page in the webapp directory in lift that can be accessed by users?

Currently only the index.html can be accessed through http://localhost:8080/ or http://localhost:8080/index.html

Say I add a static file newpage.h开发者_开发知识库tml into webapp dir, then what can I do so users can access it through http://localhost:8080/newpage.html ?


It's been a long time since I've done anything with Lift, but from what I remember, the easiest way may be to add the page in the menu entries in the bootstrap.liftweb.Boot.scala class. If you've setup your project using one of Lift's maven archetypes, this class should be there in your project. In this class, there's the following line (or something resembling it, the example I got still uses Lift 1.0, currently I believe they are already heading towards a 2.0 release):


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

If you change that line to the following:


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

than you can acess your welcome page directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜