views:

60

answers:

2

I'm new to Lift framework for scala. For some reason, index.html resides in the web-app directory, and when I start up jetty, http://localhost:8080/ will point to that index.html file just fine. However, if I put a login.html file in the same folder as the index.html, and then go http://localhost:8080/login, Lift does not serve the file.

Where do I need to put the files to get them register? I am a little lost because the behaviour only seems to work for index.html and nothing else.

This is what happens when I view source in Chrome:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; 
<html> <body>The Requested URL /login was not found on this server</body> </html>  
+1  A: 

To give an answer to your last comment: if you use the default Lift archetype to try out lift: this uses the SiteMap that provides a menu for your site. This is defined in the bootstrap.liftweb.Boot.scala class. By default, using a sitemap with a menu controls the pages that you can access in your application. I'm not sure whether there is an easy way to disable that functionality, so if someone knows, please comment. If you do not want this at all, you can disable it by removing the val entries = Menu(Loc("Home", List("index"), "Home")) :: Nil and LiftRules.setSiteMap(SiteMap(entries:_*)) in the Boot class. That way you can access any page that you want directly by going to the URL.

Arjan Blokzijl
+3  A: 

Please see the SiteMap wiki page: http://liftweb.assembla.com/wiki/show/liftweb/SiteMap

The reason for SiteMap is a unification of menu generation and access control. You can refer to pages by name and if you move them around in the directory hierarchy, with SiteMap, the links will always work. SiteMap provides a type-safe mechanism for extracting query parameters and path information so that your current page can have the associated objects and the URL for a page can be calculated by passing the object to the Loc.

SiteMap may seem like its a little heavy weight, but if you're going to build a site that has different access control rules for different pages, SiteMap gives you a nice, unified mechanism for both presentation and security.

If you don't want to use SiteMap, just remove the LiftRules.setSiteMap() line from Boot.scala and Lift will serve any page.

David Pollak