java - Message bundle intermittently not rendering correct -


in application trying labels out of message bundle. rather use constant key values using variables

<c:foreach var="emailaddress" items="${emailaddresses}"> ... <c:set var="labelkey" value="contact_label_${emailaddress.type}"/> ... <h:outputtext value="#{faces_translations[labelkey]}"/> ... </c:foreach> 

most of time works correctly, every when page loaded of label not processed correctly , following message displayed:

???contact_label_??? 

it looks email.type not return value, added debug code print out value of email.type including

${emailaddress.type} 

and saw value returned.

another thing tried remove value everytime before setting again inside loop using . resulted in following exception. verified had tag library included in war file (jstl-api-1.2.jar , jstl-impl-1.2.jar javax.faces-2.1.7).

<c:remove> tag library supports namespace: http://java.sun.com/jsp/jstl/core, no tag defined name: remove 

both these issues baffling. label works of time, not consistently. tag defined in included library, cannot found.

thanks in advance pointers.

jsf ui components , tag handlers jstl doesn't run in sync. jstl runs when jsf view built. result jsf component tree without tag handlers <c:xxx> , <f:xxx>. jsf ui components runs when jsf view needs generate html http response. same jsf view can reused multiple times in subsequent http requests long you're interacting same view returning null or void on post actions (like should use @viewscoped bean). not true jstl tags runs on every single http request. that's went wrong in case.

rather use jsf ui components if want consistent render-time behaviour while reusing same view. construct can replaced follows:

<ui:repeat var="emailaddress" value="#{emailaddresses}">     ...     <ui:param name="labelkey" value="contact_label_#{emailaddress.type}" />     ...     <h:outputtext value="#{faces_translations[labelkey]}" />     ... </ui:repeat> 

see also:


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -