以编程方式访问struts中的属性文件

时间:2011-08-01 08:47:25

标签: struts resourcebundle

我正在尝试访问属性文件以在struts java文件中自定义消息。我想知道如何在java文件中以编程方式访问属性文件中的键。

1 个答案:

答案 0 :(得分:0)

您可以在struts动作类中尝试:

    String fileName ="filepname"; //property fileName 
    FileInputStream fis = new FileInputStream(new File(fileName));
    Properties props = new Properties();
    props.load(fis); //load the property file

    String posterVarName = props.getProperty("property"); //get property
相关问题