MMBase Resource Bundle

MMBaseResourceBundle is an implementation of an editable java resource bundle that loads and saves it's values in MMBase. The values are stored in 4 builders

MMBaseResourceBundle automatically creates keys for undefined values (configurable) and comes with an editor

Setup

The setup of MMBase resource bundle is quite easy (in combination with mmbase 1.8). the jar will create the mmbase objects as needed. in order to use the editor you need to configure an editor servlet. This is done in the web.xml by adding the servlet to the list of servlets and adding a servlet mapping to the list of mappings. You also need to copy the templates over to the root of the mmbase configuration.

  <!-- the editor servlet -->
  <servlet>
    <servlet-name>resourceBundleEditor</servlet-name>
    <description>resourceBundleEditor</description>
    <servlet-class>net.sf.mmapps.resourcebundle.edito.ResourceBundleEditorServlet</servlet-class>
    <load-on-startup>5</load-on-startup>
  </servlet>
  <!-- a mapping for the servlet -->
  <servlet-mapping>
    <servlet-name>resourceBundleEditor</servlet-name>
    <url-pattern>/re</url-pattern>
  </servlet-mapping>
  

Using

Using the MMBaseResourceBundle works just like using a normal resource bundle. There is only one constraint. Your keys must contain at least 3 dots. rbe.editor.top.header for example defines a rbe group with a editor basename and a top.header key name

<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<fmt:bundle basename="net.sf.mmapps.resourcebundle.MMBaseResourceBundle">
    <fmt:message key="rbe.editor.top.header"/>
</fmt:bundle>