python在同一行中显示进度文字
2013-08-01 22:22
288 查看
1. 在ApplicationContext 中定义messageSource
其中basenames就是指定的多国语言properties 文件前缀format.properties 这些文件在classpath即可,可以在WEB-INF的classes目录下,也可以打在jar包中放在WEB-INF/lib下
2. 编辑properties 文件,推荐eclipse的rbe插件
3. 在java程序中使用多国语言
通常的做法是把MessageSource 直接注入到bean中,具体参考spring
4. jsp中使用多国语言
3.0中spring拆分了多个包spring.tld文件包含在org.springframework.web.servlet-3.0.X.RELEASE.jar中,web项目要包含此jar否则tld报错
然后在jsp中引入标签库
jsp文件中通过
来引用对应的message
<beans> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>format</value> <value>exceptions</value> <value>windows</value> </list> </property> </bean> </beans>
其中basenames就是指定的多国语言properties 文件前缀format.properties 这些文件在classpath即可,可以在WEB-INF的classes目录下,也可以打在jar包中放在WEB-INF/lib下
2. 编辑properties 文件,推荐eclipse的rbe插件
3. 在java程序中使用多国语言
public static void main(String[] args) { MessageSource resources = new ClassPathXmlApplicationContext("beans.xml"); String message = resources.getMessage("message", null, "Default", null); System.out.println(message); }
通常的做法是把MessageSource 直接注入到bean中,具体参考spring
4. jsp中使用多国语言
3.0中spring拆分了多个包spring.tld文件包含在org.springframework.web.servlet-3.0.X.RELEASE.jar中,web项目要包含此jar否则tld报错
然后在jsp中引入标签库
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
jsp文件中通过
<spring:message code="system.login.error " />
来引用对应的message
相关文章推荐
- Python3 Tkinter基础 创建显示一行文字的窗体并设置窗体的标题 Label,title
- Python下定义一个函数来显示相应的进度条
- Android TextView文字太多显示的最后一行被盖住一半的解决办法
- CSS控制图片和文字在同一行显示且对齐的3种方法
- python在cmd窗口显示彩色文字
- testArea中的文字显示为一行,不换行
- python学习--下载--下载固定文件显示下载百分之的进度
- android 跑马灯 文字一行能显示全也能跑马灯
- 【CSS笔记】使文字在一行显示,超出部分用省略号显示
- Python3使用requests模块显示下载进度
- Python获取下载速度并显示进度条
- python完成进度百分号显示
- css是文字超过一行部分显示为省略号
- 解决TextView在显示文字的时候,一行还没显示满就跳到下一行
- 《Cocos2d-x游戏开发实战精解》学习笔记2--在Cocos2d-x中显示一行文字
- Python在同一位置刷新显示进度信息
- ios 一行中的文字显示多种颜色
- 文字一行显示,超出部分显示省略号
- 使用mmit进行移动开发,如何在一行同时显示图片和文字.
- Python3 Tkinter基础 Label 显示的文字换行