访问属性文件中的支柱编程

问题描述 投票:0回答:1

我试图访问propertfile用于自定义消息,在struts的java文件。我想知道如何以编程方式访问Java文件中的属性文件的关键。

struts resourcebundle
1个回答
0
投票

您可以在Struts Action类试试这个:

    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
© www.soinside.com 2019 - 2024. All rights reserved.