转载:http://ceapet.com/blog/index.php?option=com_content&view=article&id=204:jsfproperties&catid=38:java&Itemid=64
p.properties文件内容如下
name=ceapet
description=Ceapet online exam system!
在.jsf文件中如下调用
#{main.p.name}
#{main.p.description}
创建一个类,便于加载
p.properties
import java.io.*;
import java.util.Properties;
public class main
{
public static Properties p;
public main()
{
if(this.p == null)
{
try
{
String filename = "../webapps/*/p.properties";
File f = new File(filename);
if(f.exists())
{
InputStream is = new FileInputStream(filename);
p = new Properties();
p.load(is);
is.close();
}
else
{
System.out.print(filename + "不存在");
}
f = null;
}catch(Exception ex){System.out.print(ex.getMessage());}
}
}
public Properties getP()
{
return this.p;
}
}
这是一个比较管用的方法。但是,我一直还不知道jbpm-console中的#{msgs['name']}是如何实现的。至今我还不知该怎样在JSF中 想方法传递参数。