如何将Managed Bean字段设置为ui:param的值? [英] How do I set Managed Bean field to the value of a ui:param?

查看:105
本文介绍了如何将Managed Bean字段设置为ui:param的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSF页面,该页面包含在其他JSF页面中(基本上是页面标题,带有公共信息).该公共页面具有其自己的控制器,并且依赖于包括该公共页面的页面向其传递一些公共数据.

I have a JSF page that is included in other JSF pages (basically a page header, with common information). This common page has its own controller and is reliant that the page which includes this common page pass it some common data.

具体来说,我目前正在尝试使用以下方法在其他页面上包含此公共页面:

Specifically, I am currently trying to include this common page on other pages using:

<ui:include src="commonPage.xhtml">
   <ui:param name="commonData" value="#{thisPagesController.commonData}"/>
</ui:include>   

应将"commonData"传递给commonPage.xhtml页面,并在理想情况下在CommonPageController类上设置"commonData"属性:

Which should pass "commonData" to the commonPage.xhtml page and ideally set the "commonData" property on the CommonPageController class:

@ManagedProperty("#{commonData}")
CommonData commonData;

但是,这不起作用...托管属性未设置.

However, this is not working... the managed property is not getting set.

执行此操作的正确方法是什么?

What is the proper way to do this?

推荐答案

请参阅BalusC的评论. JSF API规范中对此没有标准.请使用复合或自定义组件.

See comment from BalusC. There is no standard for this in the JSF API spec. Use a composite or custom component instead.

这篇关于如何将Managed Bean字段设置为ui:param的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆