Lift If LocParam 奇怪的行为
lift框架中有一个LocParam
If
。我想知道它是如何工作的。我有一个简单的菜单,其中包含几个项目,如下所示:
val scanning = Menu(Loc("scanning","user" :: "scanning" :: Nil,
S ? "scanning",LocGroup("user")))
效果很好,但是当我添加 If
时,会出现奇怪的行为。首先, 标签中呈现的标签不正确,它们取自其他
Menu
定义。 (我看到的不是资源键“扫描”的内容,而是 S ?“主页”的内容)。其次,我认为它不起作用,条件应该将 /user/scanning 上的所有访问重定向到 / 因为条件每次都是 false,并且它只是让底层代码片段呈现自身,就好像没有任何条件一样。
val scanning = Menu(Loc("scanning","user" :: "scanning" :: Nil,
S ? "scanning",LocGroup("user"),If(() => false,() => RedirectResponse("/"))))
there is a LocParam
If
in lift framework. I'm wondering how it is meant to work. I have a simple menu of several items like this one:
val scanning = Menu(Loc("scanning","user" :: "scanning" :: Nil,
S ? "scanning",LocGroup("user")))
which works just good, but when I add the If
, there is weird behaviour. Firstly, the labels that are rendered in the <a>
tag are not correct, they are taken from other Menu
definitions. (Instead of the content of resource key "scanning", I see the contents of S ? "homepage"). Secondly, it just doesn't work, I assume, that the condition should redirect all accesses on /user/scanning to / since the condition is false everytime and it just lets the underlying snippet to render itself as if there wasn't any condition.
val scanning = Menu(Loc("scanning","user" :: "scanning" :: Nil,
S ? "scanning",LocGroup("user"),If(() => false,() => RedirectResponse("/"))))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这告诉电梯永远不会显示您的菜单条目。所以你看到的可能是一个不同的条目......
That tells lift to never show your menu entry. So what you see is probably a different entry...