找出 JSF 1.2 中的当前页面是什么

发布于 2025-01-06 07:27:58 字数 88 浏览 5 评论 0原文

我需要弄清楚我正在使用 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 技术交流群。

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

发布评论

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

评论(1

哀由 2025-01-13 07:27:58

您可以使用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.

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