【问题标题】:Execute a bean action on page load using JSF2 and richFaces4使用 JSF 2 和 richFaces 4 在页面加载时执行 bean 操作
【发布时间】:2011-12-17 11:26:36
【问题描述】:

我正在处理 JSF2richFaces4 应用程序,我想在加载我的 xhtml 视图之一时执行支持 bean 操作。

谢谢。

【问题讨论】:

    标签: jsf-2 richfaces


    【解决方案1】:

    如果你创建一个 bean @ViewScoped,一个带有 @PostConstruct 注释的方法将在渲染引用它的 xhtml 视图时被调用一次。

    例如:

    @ManagedBean
    @ViewScoped
    public class Foo {
      @PostConstruct
      public void onPageLoad() {
      ...
      }
    }
    
    
    <h:outputText value=#{foo.property}"/>
    

    【讨论】:

      猜你喜欢
      • 2018-05-21
      • 2016-06-26
      • 2012-04-12
      • 2014-01-30
      • 2013-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多