You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/03/10 19:31:45 UTC
DO NOT REPLY [Bug 17838] New: -
Bean:message should Trim keys before dereferencing
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17838>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17838
Bean:message should Trim keys before dereferencing
Summary: Bean:message should Trim keys before dereferencing
Product: Struts
Version: 1.1 RC1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Enhancement
Priority: Other
Component: Custom Tags
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: jeffs@centralscheduling.net
<%@ 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. The key should be trimmed before it is dereferenced. If for some reason
that is a bad idea, then at least put quotes around the key in the debug log
so that the trailing space becomes evident.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org