开发者

what's wrong in this el expression?

<ui:repeat value="#{admin.detailTypesList}" var="detailType">
<h:outputText value="#{admin.getDetailTypeTranslation('ContactDetailType_'+detailType)}"/>
</ui:repeat>

for the el expression:

#{admin.getDetailTypeTranslation('ContactDetailType_'+detailType)}

The parameter passed to getDetailTypeTranslation is 'ContactDetailT开发者_StackOverflowype_' (without the detailType value)

What am I doing wrong?


In EL, the + is exclusively a sum operator. You can use <ui:param> to create a new variable which exist of a string concatenated with an EL expression and then use the new variable instead.

<ui:repeat value="#{admin.detailTypesList}" var="detailType">
    <ui:param name="contactDetailType" value="ContactDetailType_#{detailType}" />
    <h:outputText value="#{admin.getDetailTypeTranslation(contactDetailType)}"/>
</ui:repeat>

Please note that this problem is not related to JSF, but to EL in general.


jsf's EL doesn't really have the concat operation ('+'). You should write a function to do it or use a bean method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜