Search code examples
javatomcatliferay

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


I have problems to read info from properties file "liferay-portal-6.1.0/tomcat-7.0.23/lib/myweb-application.properties" in portal_normal.vm 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>

Solution

  • PropsUtil (or $propsUtil) accesses portal.properties, typically configured through portal-ext.properties. So unless you add your myweb-application.properties as an "external properties" file, PropsUtil won't find it.

    One way to do this is to add this line to your portal-ext.properties:

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

    but make sure it's not using the same keys as portal.properties for different purposes.