Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF: Creating aliases for properties in backing bean

Tags:

jsf

facelets

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?

like image 494
Tuukka Mustonen Avatar asked Jan 03 '11 15:01

Tuukka Mustonen


2 Answers

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}" />
like image 90
Shervin Asgari Avatar answered Sep 22 '22 00:09

Shervin Asgari


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

like image 40
McDowell Avatar answered Sep 18 '22 00:09

McDowell