You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Smith <je...@centralscheduling.net> on 2003/03/10 18:26:57 UTC

[Q] Bug in bean:message?

I've created a generic message page that shows a message to my users based
on a request parameter.

I've created a jsp tile to encapsulate this behavior which looks like this:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<bean:parameter id="messageTileKey" name="messageTileKey"/>
<bean:define id="messageKey" value='<%= "pages." + messageTileKey +
".message"%>'/>
<bean:define id="titleKey" value='<%= "pages." + messageTileKey + ".title
"%>'/>
<p><bean:message  key='<%=titleKey%>'/></p>
<p><bean:message  key='<%=messageKey%>'/></p>


My application.properties has the following two lines in it:
    pages.testmessage.title=Test Message Page
    pages.testmessage.message=Congratulations! You have found the test
message page.

But when I try to invoke the page, I get the following error thrown:
    2003-03-09 10:05:25 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
    org.apache.jasper.JasperException: Missing message for key
pages.testmessage.title

It took me a long time to figure this out. If you look very closely at the
4th line in the jsp file, you'll see an errant space inside the .title
literal. Obviously it is very hard to see the trailing space in the error
log. Should the message keys be Trim'd before their dereferenced? Or is this
a behavior that is sometimes useful? At the very least, quotes around the
key name in the log would make the trailing space more visible.

Jefficus


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org