如何从 JSF 中的支持 bean 读取表变量?

发布于 2024-08-08 21:37:29 字数 446 浏览 5 评论 0原文

我正在使用 MyFaces Trinidad,并且想要创建一个页面,其中一个表中的选择会重新加载另一个表的内容以匹配选择。

更新由 partialSubmit 中的 actionListener 触发。然后我希望支持 bean 中的侦听器记住提交的行对象,以便第二个表的值的 getter 可以使用它作为过滤器。

Trinidad 文档包含此示例,但此语法在 JSF 1.2 中已弃用:

FacesContext context = FacesContext.getCurrentInstance();
MyClass selection = (MyClass)context.getVariableResolver().
    resolveVariable(context, "rowdata");

有人有好的建议吗?

I am using MyFaces Trinidad, and want to create a single page where selection in one table reloads the content of another table to match the selection.

The update is triggered by an actionListener in a partialSubmit. Then I wanted the listener in the backing bean to remember the row object of the submit, such that the getter for the value of the second table can use this as a filter.

The Trinidad documentation includes this sample, but this syntax is deprecated in JSF 1.2:

FacesContext context = FacesContext.getCurrentInstance();
MyClass selection = (MyClass)context.getVariableResolver().
    resolveVariable(context, "rowdata");

Anybody got a good suggestion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

ι不睡觉的鱼゛ 2024-08-15 21:37:30

JSF 1.2 方式是使用 ELResolver。另请参阅 VariableResolver 的 javadoc 中的弃用注释。更常见的 JSF 1.2 替代方法是 Application#evaluateExpressionGet()。代码示例可以在此处找到。

The JSF 1.2 way is using ELResolver. Also see the deprecation notes in the javadoc of VariableResolver. A more common JSF 1.2 alternative is the Application#evaluateExpressionGet(). Code examples can be found here.

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