Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-2941

Add text replacing tag library with resolving variables based on given resource bundle or default JSTL localization context

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 2.28.01
    • None
    • None

    Description

      In a project, I implemented a JSP tag library which replaces the
      embedded text containing variables like the following:

      <ns1:messagesReplace>Hello, ${name}!</ns1:messagesReplace>

      or

      <%-- suppose ${document.greeting} rendered as "Hello, ${name}" from the
      text document property directly.. --%>
      <ns1:messagesReplace><c:out
      value="${document.greeting}"/></ns1:messagesReplace>

      By default, the tag resolves all the variables by using the current java
      resource bundle (via JSTL's LocalizationContext).
      The tag also has an attribute ("bundle") to set a custom resource bundle
      object or another attribute ("basename") for a bundle basename string.

      Also, some people want to have a placeholder feature like the following:
      "I have to mix CMS content with data I receive from a rest service. I want the editor to be able to add a placemarker to the text where the data from the restservice can be injected. For instance a CMS document that contains the string "Your telephone number is %s", where the content for %s is delivered by a rest service (e.g. "012-3456789")."

      I think this JSTL tag library can be used for that use case, too.
      This tag can be used in a template page and a custom resource bundle (see [1] as an example) can be provided in the component code for the tag.

      [1]
      http://svn.onehippo.org/repos/hippo/hippo-cms7/site-toolkit/trunk/components/resourcebundle/src/main/java/org/hippoecm/hst/resourcebundle/SimpleListResourceBundle.java

      Attachments

        Activity

          People

            jsheriff Junaidh Kadhar Sheriff
            wko Woonsan Ko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: