Facelet 模板和上下文路径
我有一个 jsf 应用程序,在上下文根目录和该上下文根目录的子文件夹中包含多个facelet。所有这些facelet 都源自驻留在上下文根中的模板,称为layout.xhtml。
我使用以下标签从所有 Facelets 引用此模板:
<ui:composition template="/layout.xhtml">
这工作正常。
在我的layout.xhtml 中,我有一个可以在facelets 之间移动的菜单。但导航仅在链接引用如下所示时才起作用:
<p:menuitem value="" url="/faces/user.xhtml" icon="/resources/images/cog_edit.png"/>
当然,faces servlet 需要一些“/faces/”才能处理此请求,但是为什么它在没有“/faces”的 ui:composition 中也能工作。
只是为了了解..
感谢您的帮助。
I have a jsf application with several facelets in context root and inside a subfolder of this context root. All of these facelets are derived from a template that resides in the context root and is called layout.xhtml.
I reference this template from all facelets with the following tag:
<ui:composition template="/layout.xhtml">
This works fine.
In my layout.xhtml I have a menu to move between the facelets. But navigation works only if link references look like:
<p:menuitem value="" url="/faces/user.xhtml" icon="/resources/images/cog_edit.png"/>
Of course, the faces servlet needs some "/faces/" in order to handle this request, however why does it work in ui:composition without "/faces".
Just to understand..
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解, ui:composition 属性只是指向正在使用的模板的相对位置。虽然导航项需要实际路径,但您已将其设置为包含“/faces/”。
As I understand, the ui:composition attribute is simply pointing to the relative location of the template being used. While the navigation item needs the actual path, which you have set as including "/faces/".