Recently I was looking at a JavaServer Faces application, that did something relatively simple – but was exhibiting strange behavior. The output shown on the page (and this is a simplified version of the real life situation) was:

dlroWolleH

I had been asked to look into the situation and correct it. Before starting to make any changes I decided to familiarize myself with the application as it currently was. And then they almost tricked me.

The JSF page had a simple outputText component with an EL Expression in its value attribute. Something like:

<h:outputText value="#{someBean.property}"/>

I decided to take a look at the code for that bean, to understand the logic behind deriving the value of the outputText. So I first opened the faces-config.xml file to find the managed bean declaration that would tell me which class definition was behind the bean included in the EL expression. However, the faces-config.xml did not contain any managed bean definitions at all. None. And yes, I tried to see whether the web.xml specified any other faces-config.xml alternatives. But it did not.

Slowly it dawned on me (more…)