我可以这样做在JSF资源包属性的文本文件:变量替换JSF资源包属性文件
receptionContact=Reception
reservationContact=Reservation
receptionEmail={receptionContact}
reservationEmail={reservationContact}
我可以这样做在JSF资源包属性的文本文件:变量替换JSF资源包属性文件
receptionContact=Reception
reservationContact=Reservation
receptionEmail={receptionContact}
reservationEmail={reservationContact}
您可以parameterize你的资源包,但键的值的无反光重用。请看看这个: https://code.google.com/p/reflectiveresourcebundle/
因此,你没有重复你的自我!
没有:
company.service.phone=555-1212
[email protected]
my.error.message=Problem accessing account!\
Please call customer service at 555-1212 \
or email us at [email protected]
有了:
company.service.phone=555-1212
[email protected]
my.error.message=Problem accessing account!\
Please call customer service at ${company.service.phone} \
or email us at ${company.service.email}
Here约为格式的另一个有趣的教程。
你在JSF上试过这个吗? –
是的。我用它来学习如何在jsf中使用自定义资源包:http://www.andygibson.net/blog/article/resource-bundles-in-jsf-2-0-applications/ – Robin
嗨,哥们,我认为你可能错误地得到了我的问题,我试图重用资源包本身的文本。 –
您是否找到答案? –