[size=medium]在java代码中可以这样使用国际化:[/size]
[size=medium]在jsp的页面上可以通过标签使用国际化:[/size]
[size=medium]使用的前提:
在配置文件中写入:[/size]
[img]http://dl2.iteye.com/upload/attachment/0085/6898/f034f0b5-6d09-343e-8a50-f54ba1a2c7c3.png[/img]
ApplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml");
str = ctx.getMessage("chengang", null, new Locale("zh", "CN"));
[size=medium]在jsp的页面上可以通过标签使用国际化:[/size]
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<fmt:message key="welcome.title"/>
[size=medium]使用的前提:
在配置文件中写入:[/size]
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages/messages" />
<property name="cacheSeconds" value="0" />
</bean>
[img]http://dl2.iteye.com/upload/attachment/0085/6898/f034f0b5-6d09-343e-8a50-f54ba1a2c7c3.png[/img]