JSF:为支持bean中的属性创建别名 [英] JSF: Creating aliases for properties in backing bean

查看:156
本文介绍了JSF:为支持bean中的属性创建别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是很深的对象层次结构,它在EL中的名称很隐蔽,就像#{myBean.configBaseStack.excludeMethodFromAccounting.method.TimeoutBehaviorEnabled}一样.

I am referring to pretty deep object hierarchies with pretty cryptic names in EL as in #{myBean.configBaseStack.excludeMethodFromAccounting.method.TimeoutBehaviorEnabled}.

我想通过如下别名来指向这个完全相同的属性:

I would like to point to this very same property through an alias like in:

<x:alias name="m" value="#{myBean.configBaseStack.excludeMethodFromAccounting.method" />
<h:inputText value="#{m.TimeoutBehaviorEnabled}" />

我想一种实现此目的的方法是在支持bean中创建这些别名,但我宁愿将其留给模板.

I guess one way to accomplish this would be to create these aliases in the backing bean, but I'd rather leave that to the template.

如何在模板/方面级别上做到这一点?

How to accomplish this in template/facelet level?

推荐答案

我认为您可以使用<ui:param>完成此操作:

I think you can use <ui:param> to accomplish this:

<ui:param name="m" value="#{myBean.configBaseStack.excludeMethodFromAccounting.method}"/>

然后您可以在同一页面上像这样使用它:

Then you can use it like this on the same page:

<h:inputText value="#{m.TimeoutBehaviorEnabled}" />

这篇关于JSF:为支持bean中的属性创建别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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