找出 JSF 1.2 中的当前页面是什么
我需要弄清楚我正在使用 bean 的当前页面是什么。
比如从 facesContext 获取当前表单 id 并将其与 const 字符串进行比较。
I need to figure out what the current page is I'm on using a bean.
Something like getting the current form id from facesContext and compare it to a const string.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用facesContext.getViewRoot().getViewId()。
请注意,这是当前正在处理的 JSF 视图。如果您通过 Servlet 使用转发技术或在没有重定向的情况下进行导航,则这不一定与用户地址栏显示的内容相同。
You could use
facesContext.getViewRoot().getViewId()
.Be aware that this is the current JSF view that's being processed. If you use forwarding techniques via a Servlet or do navigation without a redirect, this is not necessarily the same as what the user's address bar is showing.