I have a portlet embedded in a theme. The only solution that I found to permit the theme to get parameters values from the portlet is to use an intermediate database. What I did is that I created a table in the portlet and then I tried to access to this table from the theme:
Java Code in the portlet:
ExpandoTable table=null;
try {
table = ExpandoTableLocalServiceUtil.addTable(CompanyLocalServiceUtil.getCompanies().get(0).getCompanyId(), User.class.getName(), "ClientTab");
}
catch ( DuplicateTableNameException dtne) {
table=ExpandoTableLocalServiceUtil.getTable(CompanyLocalServiceUtil.getCompanies().get(0).getCompanyId(), User.class.getName(), "ClientTab");
}
The velocity code in the theme:
#set ($accountsTableName = "ClientTab")
#set ($accountsTable = $expandoTableLocalService.getTable($accountsTableName, $accountsTableName))
#if (!$accountsTable)
<h2> The table ClientTab doesn't exist </h2>
#else
<h2> Well The table ClientTab exists </h2>
#end
But the result that I got is:
The table ClientTab doesn't exist
I used those references to develop my code:
http://myjavaexp.blogspot.com/2013/01/liferay-expando-services.html
http://www.liferay.com/fr/web/raymond.auge/blog/-/blogs/715049