【发布时间】:2014-03-09 08:13:18
【问题描述】:
我计划在 Tomcat 中使用一个带有一些 JSF 托管 Bean 的 *.xhtml 页面。我想成为ViewScoped的所有豆子。我需要将一些数据(通常是一个简单的 POJO)从一个 bean 传递到另一个,但是...
@managedProperty 不起作用。
findBean("someBean") - 未知标识符。
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("sessionBean"); - 与 SessionScoped bean 一起使用。 ViewScoped 呢?
出于安全原因,我不想通过GET 参数传递整数标识符。
理论上,我可以使用SessionScoped bean 来传输数据,但这是最好的解决方案吗?
是否有任何方法可以从一个 ViewScoped bean 访问另一个,例如 FacesContext.getCurrentInstance()...?
我猜,所有ViewScoped bean 都同时实例化,并且生命周期相同。我说的对吗?
感谢您为我浪费时间。
【问题讨论】:
-
@ManagedProperty应该可以工作。你想在你的 bean 中访问什么?
标签: jakarta-ee tomcat jsf-2