In my JSF project, i have something like this
<h:outputText value="#{msg[foo]}" />
where msg is my ResourceBundle and foo is the variable for the identifier of the properties, containing for example label.car, so that the code would return either car or Auto (internationalization).
The problem:
If foo is set to a property identifier which doesn’t exist in the ResourceBundle, lets say boat, the app, of course, crashes with a javax.el.PropertyNotFoundException.
While in Spring there is a way to handle this as a fallback with a default message..
<spring:message code="${foo}" text="${foo}" />
(returning the identifier itself instead of it’s internationalized value)
..I was not able to do this in JSF.
Any hints how something similar to this is possible in JSF? Thanks!
//Update:
– Apache Tomcat/6.0.29
– Apache MyFaces-2
– PrimeFaces 3.3
– tomcat-maven-plugin:1.1
– Java version number: 1.7.0_05
– Hibernate 3.5.6-Final
I ‘solved’ the problem by adding my own tag imitating the Spring-behavior by doing this:
(excerpt of my TagHandler implementation)
So I am able to use this like: