Page 1 of 1

Label defined messages-plugin.properties accessible from JSP

Posted: Thu Apr 24, 2014 2:14 pm
by ruffp
I made a new plugin and I want to know how to refer the keys in the messages-plugin.properties from the JSP.

I the blacklist-search plugin sample the titleKey of the display:column referes to a built-in message (titleKey="mailing.E-Mail")
but in my case it would be somethin like this:

Code: Select all

<display:table class="list_table" id="item" name="resultList"  excludedParams="*">
	<display:column titleKey="ldap.result.column" class="mailing" headerClass="header" property="givenName" sortable="true" />
</display:table>
But the table header shows: ??ldap.result.column?? I guess the resource messages is not available at that moment.

Is there any way to make the plugin .properties available to the JSP's?

Re: Label defined messages-plugin.properties accessible from

Posted: Fri Apr 25, 2014 7:05 am
by mdoerschmidt
It's not possible to use message keys from plugins that way, because different plugins can define the same message key.
The only way to resolve message key from plugins is the <message> tag defined in our own taglib. The taglib is part of the OpenEMM installation.

After defining the taglib prefix
<%@ taglib uri="/WEB-INF/agnitas-taglib.tld" prefix="agn" %>

you can use the message tag like that:
<agn:message key="message.key.from.plugin" plugin="name-of-the-plugin" />

Re: Label defined messages-plugin.properties accessible from

Posted: Fri Apr 25, 2014 10:53 am
by ruffp
Thanks for your answer.

In fact after noticing the "agn" taglib, I tried someting like this:

Code: Select all

<display:table class="list_table" id="item" name="resultList"  excludedParams="*">
   <display:column title="<agn:message key="message.key.from.plugin" plugin="name-of-the-plugin" />" class="mailing" headerClass="header" property="givenName" sortable="true" />
</display:table> 
But it generates an error because the use of two imbricated tld's tags, but I succeeded to bypass this issue by using a <c:set> like this:

Code: Select all

  <c:set name="myvar">
    <agn:message key="message.key.from.plugin" plugin="name-of-the-plugin" />
  </c:set>
... 
  <display:table class="list_table" id="item" name="resultList"  excludedParams="*">
   <display:column title="${myvar}" class="mailing" headerClass="header" property="givenName" sortable="true" />
  </display:table> 
Note that using <c:set> like this:

Code: Select all

<c:set name="myvar" value="<agn:message key="message.key.from.plugin" plugin="name-of-the-plugin" />" />
... does not work as well