JSF: Creating aliases for properties in backing bean

若如初见. 提交于 2019-12-21 04:51:26

问题


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}" />

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?


回答1:


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}" />



回答2:


You could probably use the JSTL-equivalent set tag for this (using the var and value attributes).




回答3:


For all i know aliasing is not not supported in jsf, using the standard components that is.



来源:https://stackoverflow.com/questions/4585755/jsf-creating-aliases-for-properties-in-backing-bean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!