JSF 2.0 隐式导航,不同的观点
我正在寻找对 JSF 2.0 隐式导航及其如何与视图一起工作的良好解释。更准确地说,我知道从操作方法中我可以返回一个字符串,它是操作的结果。如果存在文件名与结果匹配的 JSF 视图,那么这就是隐式导航。
现在...我的问题是,如果从文件夹内的视图调用该操作,但我想要导航到的下一个视图位于不同的文件夹中,该怎么办?即,从 /manager/edit.xhtml
调用一个操作。该操作应该返回什么字符串,以便导航可以安全地转到 /user/list.xhtml
或 /index.xhtml
或 /manager/index.xhtml ?
I'm looking for a good explanation to JSF 2.0 implicit navigation and how it works with views. To be more precise, I understand that from an action method I can return a string which is the outcome of the action. If there's a JSF view whose file name matches the outcome, then this is implicit navigation.
Now... my question, what if the action is invoked from a view that's inside a folder but the view that I want to navigate to next is in a different folder? I.e., from /manager/edit.xhtml
an action is invoked. What String should that action return so that navigation can safely go to /user/list.xhtml
or to /index.xhtml
or to /manager/index.xhtml
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,JSF 仅在当前上下文中寻找匹配的视图。您可能必须在 faces-config.xml 中定义导航规则才能以特殊方式处理结果。这是一个例子:
-Praveen。
As far as my knowledge goes, JSF looks for a matching view only within the current context. You probably have to define a navigation rule in your faces-config.xml to handle an outcome in a special way. Here is an example:
-Praveen.
您可以使用隐式导航来访问其他文件夹中的视图。
只需在视图中执行以下操作:
或
You can use implicit navigation to get to views in other folders.
Just do something like this in a view:
or