如何调用另一个属性文件?
我在同一级别的 src 文件夹中有两个名为 example.properties 和 Sample1.properties 的属性文件。
它有一些信息,例如,
A1 = please call {sample1:name}
这里, 样本1 ->属性文件名 姓名->在sample1中定义的键如[name = abc]
我想调用sample1属性文件,从该文件中获取name的值并将其存储到sample.properties中的A1键中。
有什么方法可以包含其他属性文件并从中获取值吗?
提前致谢。
问候, 马尤尔·帕特尔
I'm having two property file called sample.properties and sample1.properties in src folder at same level.
It is having some information like,
A1 = please call {sample1:name}
Here,
sample1 -> property file name
name -> key defined in sample1 like [name = abc]
I want to call sample1 property file , get value of name from that file and store it into the A1 key in sample.properties.
Is there any way to include and fetch value from other property file?
Thanks in Advance.
Regards,
Mayur Patel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
恐怕我认为你做不到这一点。我的理解是,每个 portlet 只能提供一个属性文件。
您想通过这种方法实现什么目标?为什么不能只使用一个属性文件?
I'm afraid I don't think you can do this. My understanding is that you can only provide one properties file per portlet.
What are you trying to achieve with this approach? Why can't you just use one properties file?
我不是通过从相同的属性文件调用属性文件来实现同样的问题,而是使用 stringtokenzier 将标记 n 从中分割出来,我获取属性文件的名称,并且仅从 java 代码调用该文件。
实际上我想知道是否有可能实现这一目标..感谢您的想法
问候,
马尤尔·帕特尔
I achieved same problem not by calling property file from the same but I used stringtokenzier to split that token n from that i get name of property file and i called that file from java code only.
actually I wanted to know is it poosible to achieve this..thanks for your ideas
Regards,
Mayur Patel