我应该将 html 文件放在 web-app 文件夹中的哪里,以使用 Maven 进行电梯项目?

发布于 2024-09-06 09:19:50 字数 702 浏览 3 评论 0原文

我是 scala 的 Lift 框架的新手。由于某种原因,index.html 驻留在 web-app 目录中,当我启动 jetty 时, http://localhost:8080 / 将指向该 index.html 文件就好了。但是,如果我将 login.html 文件放在与 index.html 相同的文件夹中,然后转到 http://localhost :8080/login,Lift 不提供该文件。

我需要将文件放在哪里才能注册?我有点迷失,因为这种行为似乎只适用于 index.html 而没有其他。

当我在 Chrome 中查看源代码时会发生以下情况:

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

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"> 
<html> <body>The Requested URL /login was not found on this server</body> </html>  

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

榕城若虚 2024-09-13 09:19:51

请参阅 SiteMap wiki 页面:http://liftweb.assembla.com/wiki/show/ liftweb/SiteMap

SiteMap 的原因是菜单生成和访问控制的统一。您可以按名称引用页面,如果您使用 SiteMap 在目录层次结构中移动它们,则链接将始终有效。 SiteMap 提供了一种类型安全的机制来提取查询参数和路径信息,以便当前页面可以拥有关联的对象,并且可以通过将对象传递给 Loc 来计算页面的 URL。

SiteMap 可能看起来有点重,但是如果您要构建一个对不同页面具有不同访问控制规则的站点,SiteMap 为您提供了一个很好的、统一的表示和安全机制。

如果您不想使用 SiteMap,只需从 Boot.scala 中删除 LiftRules.setSiteMap() 行,Lift 将提供任何页面。

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.

最笨的告白 2024-09-13 09:19:51

要回答您最后的评论:如果您使用默认的 Lift 原型来尝试 lift:这将使用为您的站点提供菜单的 SiteMap。这是在 bootstrap.liftweb.Boot.scala 类中定义的。默认情况下,使用带有菜单的站点地图可以控制您可以在应用程序中访问的页面。我不确定是否有一种简单的方法来禁用该功能,所以如果有人知道,请发表评论。
如果您根本不需要此功能,可以通过删除 val Entry = Menu(Loc("Home", List("index"), "Home")) :: Nil 来禁用它Boot 类中的 LiftRules.setSiteMap(SiteMap(entries:_*))。这样您就可以通过 URL 直接访问您想要的任何页面。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文