Label defined messages-plugin.properties accessible from JSP

Use this forum for all questions related to the source code of OpenEMM

Moderator: moderator

ruffp
Posts: 10
Joined: Wed Apr 09, 2014 8:45 am

Label defined messages-plugin.properties accessible from JSP

Post 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?
mdoerschmidt
Posts: 25
Joined: Fri Jan 04, 2013 8:55 am

Re: Label defined messages-plugin.properties accessible from

Post 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" />
ruffp
Posts: 10
Joined: Wed Apr 09, 2014 8:45 am

Re: Label defined messages-plugin.properties accessible from

Post 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
Post Reply