No WebApplicationContext found: not in a DispatcherServlet request and no ContextLoaderListener regi


问题描述:

国际化(i18n) 项目中中出现页面显示异常,jsp报错;异常内如下图:

原因:

直接访问了 index.jsp,index.jsp没有经过Controller跳转,导致的;出错的是标签,如果使用fmt标签的,不会报错;

1 <fmt:bundle basename="message">
2         <fmt:message key="I18N.TEST_EN_US">fmt:message>
3     fmt:bundle>
4     p>    
5     
6     

7

解决办法:

方案一:访问index.jsp页面,通过Controller跳转,

方案二:直接访问index.jsp页面,但是标签使用fmt标签;

相关