开发者

How to add a new page in Lift framework

开发者 https://www.devze.com 2022-12-31 12:05 出处:网络
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.htm

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

精彩评论

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