Websphere Application Server 6.1安装配置(二)
2012-02-11 16:02
525 查看
如果使用JSP作为JSF的视图,那么在每个也没可以用<f:loadBundle>加载国际化文件,但是使用Faclets如何进行国际化文件加载呢?我的做法如下
1. 在faces-config.xml中增加如下配置:
2. 在/WEB-INF/classes/下增加message.properties和message_zh_CN.properties两个文件,一个是默认资源文件,一个是中文资源文件。可以根据自己应用的需要添加其他语言支持。
3. 在模版文件,比如/WEB-INF/facelets/template.xhtml中加载这个资源
4. 在使用这个模版的客户端文件中不必再进行加载,直接使用即可,例如welcome.xhtml
因为我使用的是MyFaces JSF 1.1的实现,据说JSF1.2可以完全在faces-config.xml中进行配置,有机会试试~~
1. 在faces-config.xml中增加如下配置:
<application> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> <locale-config> <default-locale>zh_CN</default-locale> </locale-config> <message-bundle>message</message-bundle> </application>
2. 在/WEB-INF/classes/下增加message.properties和message_zh_CN.properties两个文件,一个是默认资源文件,一个是中文资源文件。可以根据自己应用的需要添加其他语言支持。
3. 在模版文件,比如/WEB-INF/facelets/template.xhtml中加载这个资源
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <f:loadBundle basename="message" var="msg"/> ...... </html>
4. 在使用这个模版的客户端文件中不必再进行加载,直接使用即可,例如welcome.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" template="/WEB-INF/facelets/template.xhtml"> <ui:define name="title"> ${msg.app_title} </ui:define> .... </ui:composition>
因为我使用的是MyFaces JSF 1.1的实现,据说JSF1.2可以完全在faces-config.xml中进行配置,有机会试试~~
相关文章推荐
- Websphere Application Server 6.1安装配置
- Websphere Application Server 6.1安装配置
- Websphere Application Server 6.1安装配置
- WebSphere Application Server V6.1 安装
- 为WebSphere Application Server v8.5安装并配置JDK7
- IBM WebSphere Application Server Network Deployment 8.5.0.X 安装配置及补丁升级指南之Windows系统篇
- 在 UNIX 和 Linux 系统上安装和配置 WebSphere Application Server
- 为WebSphere Application Server v8.5安装并配置JDK7
- Java 7 在 WebSphere Application Server V8.5 中的安装配置和版本切换
- 在 UNIX 和 Linux 系统上安装和配置 WebSphere Application Server
- 为WebSphere Application Server v8.5安装并配置JDK7
- linux系统安装IBM WebSphere Application Server(简称WAS)报错:JVM terminated. Exit code=1 ....
- Windows Server 2003与IBM WebSphere Application Server V6.1 吐血整理
- 配置IBMHTTPServer和WebSphereApplicationServer连接优化应用服务器性能
- 为您的 Linux 应用开发加油提速 2004: 安装 WebSphere Application Server Version 5.1
- 使用 WebSphere Application Server V6.1 中的联合存储库扩展用户注册表选项
- IBM WebSphere Application Server V7.0 中的 Web Services 安全策略及配置
- Target runtime WebSphere Application Server V6.1 is not defined
- 迁移到 WebSphere Application Server V6.1 快速指南
- Websphere Application Server Network Deployment 6 安装的问题