簡體   English   中英

Liferay:從屬性文件中獲取 portal.normal.vm 中的 URL

[英]Liferay: Get URL in portal.normal.vm from properties file

我在從 portal_normal.vm myweb-application.properties 中的屬性文件“liferay-portal-6.1.0/tomcat-7.0.23/lib/myweb-application.properties”中讀取信息時遇到問題:

redirect.docs.url = http://stackoverflow.com/questions/ask

“liferay-portal-6.1.0/tomcat-7.0.23/webapps/web-theme/templates/portal_normal.vm”:

 #set ($docsURL =  $propsUtil.get("redirect.docs.url"))  <a href="$docsURL">#language("foot.docs")</a>

獲取 portal-ext.properties 的值

例如。 test.name="sachin"

${propsUtil.get("test.name")}

PropsUtil(或 $propsUtil)訪問portal.properties ,通常通過portal-ext.properties配置。 因此,除非您將 myweb-application.properties 添加為“外部屬性”文件,否則 PropsUtil 將找不到它。

一種方法是將此行添加到您的portal-ext.properties

  include-and-override=/path/to/myweb-application.properties

但請確保它不會出於不同目的使用與portal.properties相同的密鑰。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM