以编程方式访问struts中的属性文件
我试图访问struts java文件中的propertfile来定制消息。我想知道如何在java文件中以编程方式访问属性文件中的键。您可以在structs action类中尝试:以编程方式访问struts中的属性文件,struts,resourcebundle,Struts,Resourcebundle,我试图访问struts java文件中的propertfile来定制消息。我想知道如何在java文件中以编程方式访问属性文件中的键。您可以在structs action类中尝试: String fileName ="filepname"; //property fileName FileInputStream fis = new FileInputStream(new File(fileName)); Properties props = new Properties(
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
谢谢你的代码buzz,我正试图用struts而不是java代码来实现它。@Sachin:你可以在你的action类中编写这段代码,没有任何区别。。!!