您的位置:首页 > 其它

读取资源文件的方法

2006-04-25 16:48 323 查看
读取资源文件的方法

方法一:
jsp中:<bean:message key="lable.username"/>
方法二:
MessageResources.getMessageResources("com.yourcompany.struts.ApplicationResources");
MESSAGE.getMessage(Locale.CHINESE,"error.username");

注:
getMessageResources()参数为在struts-config.xml中定义的<message-resources parameter="profile.resources.ApplicationResources"/>中的parameter信息。

方法三:

public static final ResourceBundle eBundle =
ResourceBundle.getBundle("config", Locale.SIMPLIFIED_CHINESE);//com.perlong为包名,config为资源文件名
String strMsg = eBundle.getString(strKey);

谢谢大家^o^
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: