In this post just going to share about the resource bundle concatenation, merging. If anyone tried has this kind of requirement you can use the expression like this.If you want to show the resource bundle values based on the condition you can use like this.
Consider the two bundle keys,
LBL_STAR=*
LBL _INSTRUCTION=Please select accounts. And some extra content in this key…
Now I want to show the output as below, Both will not show in the page same time. any one will render in the page. Based one some condition it will render, for example I added the both at a time.
You can also do like this in resource bundle by adding a separate key with *..
LBL_TMP_INSTRUCTION= *Please select accounts. And some extra content in this key…
but this looks like a duplicate in the resource bundle file.. think if the value is a big text..
What you will usually try ? (and what I also tried initially in my application)
<af:inputText label="#{ 1>2 ? resource.LBL_STAR : LBL_STAR + resource.LBL_INSTRUCTION }" id="it1"/>
here key values of LBL_STAR + LBL _INSTRUCTION will not work and it will give the ParseException for input string “xxx”.
#{ resource. LBL_STAR } #{ resource.LBL_INSTRUCTION } – this will be fine in case if you don’t have any expression condition, here it will show the text next to next..
<af:panelBox text="PanelBox1" id="pb1" inlineStyle="width:600px;">
<f:facet name="toolbar"/>
<af:inputText label="#{1>2 ? resource.LBL_INSTRUCTION : ''} #{1>2 ? '' : resource.LBL_STAR} #{1>2 ? '' : resource.LBL_INSTRUCTION}" id="it1"/>
</af:panelBox>
<f:facet name="toolbar"/>
<af:inputText label="#{1>2 ? resource.LBL_INSTRUCTION : ''} #{1>2 ? '' : resource.LBL_STAR} #{1>2 ? '' : resource.LBL_INSTRUCTION}" id="it1"/>
</af:panelBox>
Reference : https://forums.oracle.com/thread/2577488
No comments:
Post a Comment