Not giving up on JSF yet

I have calmed down and can now reason on what prompted my JSF rage of yesterday night.

It started with <f:viewParam> not working as expected in GlassFish 4.0. <f:viewParam> is an addition in JSF 2.0 that simplifies bookmarkable URLs, one of the biggest improvements in the new JSF specifications. Yet, as simple as my test case was, a query string parameter was not populating the Javabean on the JSF page.

An extensive web search showed that there was nothing wrong with my code, so after going from denial through to acceptance, I resigned to upgrading to the latest Mojarra.

The GlassFish 4.0 documentation stated that it was possible to include an updated Mojarra in the WAR file and to keep the original version that is bundled with GlassFish. I liked this solution because it meant that I did not have to change the default GlassFish installation. So, I proceeded by adding the following lines to glassfish-web.xml .

That still did not fix the issue, and worse, I now had the notorious Target Unreachable, identifier <xyz> resolved to null error.

I knew it had to do with the Mojarra upgrade, yet my full confidence in the setting above (recommended from other sources) kept me from trying a different approach. So I spent the evening fighting a losing battle with Mojarra.

Today, with renewed resolve, I decided to tackle the problem again. I started looking for bug reports and found this JIRA ticket. It matched the scenario that I had: <f:viewParam> was not working with the new JSF namespace. At least, this finding proved that the Mojarra upgrade was the correct fix.

Now, all I had to do was try the other approach, which is to copy the updated Mojarra JAR file into the GlassFish installation directory. I did that, and the problem promptly went away. <f:viewParam> is now working.

I did not give up on JSF because I just could not accept that such a cornerstone feature as <f:viewParam> was not working. In hindsight, I should have tried the second upgrade method much sooner, but I trusted the documentation too much. And, I was also reminded of the importance of bug reports in investigating unexpected behaviour of software. For now, I am back in full JSF swing.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: