【发布时间】:2013-12-08 04:58:40
【问题描述】:
您好,我正在尝试在我的 Spring MVC Web 应用程序中配置消息源。
我目前已经让它与 ReloadableResourceBundleMessageSource 一起运行,但我无法让它与 ResourceBundleMessageSource 一起运行。我更喜欢使用 ResourceBundleMessageSource,因为我不需要 Reload 功能,而且 ResourceBundleMessageSource 的效率略高。
在我的 rootApplicationContext 中,我将 bean 定义如下。
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/resources/locale/messages" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
<ref bean="localeChangeInterceptor" />
</property>
</bean>
这很好用..
但我一改成
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="/resources/locale/messages" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>
应用程序因异常而中断:
12:35:57,433 错误 [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringJAXWS].[jsp]] (http-localhost-127.0.0.1-8080-1) Servlet.service() 用于 servlet jsp 抛出异常:org.apache.tiles.util.TilesIOException: JSPException 包括路径“/jsp/views/layout/top.jsp”。在 org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:241) [tiles-servlet-2.2.2.jar:2.2.2] 在 org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105) [tiles-jsp-2.2.2.jar:2.2.2]
帮助!
整个项目代码可在 GITHUB 获得
https://github.com/localghost8080/JaxWS
这是所有感兴趣的人的整个堆栈跟踪。
https://github.com/localghost8080/JaxWS/blob/master/ResourceBundleException.txt
【问题讨论】:
-
你检查你的 Tiles 配置了吗?可能与TilesViewResolver有关
-
请发布完整的堆栈跟踪而不是 sn-p。
标签: java spring-mvc