怎样读资源文件里数据

Ianlan 2006-04-10 03:53:00
ApplicationResources.properties中有
loginuser = 登陆用户

<%
//这里如何获取资源ApplicationResources.properties 中loginuser的数据

%>
知道的请贴下代码...
...全文
94 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Nuage 2006-04-10
  • 打赏
  • 举报
回复
public class readProperties {
public static void readFile(){
File in=new File("test.properties");//
try {
FileInputStream filein=new FileInputStream(in);
Properties file=new Properties();
file.load(filein);
System.out.println(file.getProperty("name"));
System.out.println(file.getProperty("id"));
System.out.println(file.getProperty("password"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args){
readProperties.readFile();
}
}

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧