我们的宣言:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>WEB-INF/classes/caasMessages</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="true" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>
我们尝试了 classpath:caasMessages,我们只尝试了 caasMessages。实际文件位于 WEB-INF/classes 中,包括 caasMessages.properties、caasMessages_es.properties 等。
错误:
javax.servlet.jsp.JspTagException: No message found under code 'screen.confirmLoginStats.title' for locale 'en_US'.
at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
at org.apache.jsp.WEB_002dINF.view.jsp.ssn.casLoginView_jsp._jspx_meth_spring_005fmessage_005f0(casLoginView_jsp.java:403)
at org.apache.jsp.WEB_002dINF.view.jsp.ssn.casLoginView_jsp._jspService(casLoginView_jsp.java:105)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
等等。
我们非常非常非常确定该消息在 caasMessages.properties 中。而且,正如我在标题中所说,当 Tomcat 在 JDK6 下运行时,这可以正常工作,但在 JDK7 下失败,如图所示。