How can I use JSTL fmt:message with Struts custom MessageResources class?

I've seen lots of examples of using fmt:message when you have resource bundles.  However, I need to get my translated strings from a database so I had to create a custom class to extend MessageResources.  I've gotten bean:message to work just fine, but would like the extended functionality of fmt:message.  

Here's what in my web.xml:

Here's what's in my struts-config:

 <message-resources parameter="com.mycompany.MyMessageResources"
            factory="com.myCompany.MyMessageResourceFactory" key="branding"
            null="true" />

Here is what works:
<bean:message key="testMsg" bundle="branding" />

Here is what doesn't work:
<fmt:setBundle basename="com.mycompany.MyMessageResources"
    var="lang" scope="session"/>
<fmt:message key="testMsg" bundle="${lang}"/>

I don't get an error, but it can't seem to find the message either.  Please help!  I've been googling everywhere and can't find any examples of this.  I've tried various values for baseName and the param-value, but nothing seems to be working.

Who is Participating?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.