<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Use RandomUtil in Freemarker template in theme</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119335617" />
  <subtitle>Use RandomUtil in Freemarker template in theme</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119335617</id>
  <updated>2026-04-07T19:17:31Z</updated>
  <dc:date>2026-04-07T19:17:31Z</dc:date>
  <entry>
    <title>RE: Use RandomUtil in Freemarker template in theme</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119336696" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119336696</id>
    <updated>2020-06-09T02:45:30Z</updated>
    <published>2020-06-09T02:45:30Z</published>
    <summary type="html">Actually, I&amp;#39;d suggest building a ContextContributor to inject an instance into the FM context using a name you can look for later on. That way you avoid having to figure out the lookups to use.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2020-06-09T02:45:30Z</dc:date>
  </entry>
  <entry>
    <title>Use RandomUtil in Freemarker template in theme</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119335616" />
    <author>
      <name>Sathish Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119335616</id>
    <updated>2020-06-08T17:03:28Z</updated>
    <published>2020-06-08T17:03:28Z</published>
    <summary type="html">I need to use RandomUtil in my ftl to generate random numbers. I have set freemarker.engine.restricted.variables as empty in portal-ext.properties. Am unable to get reference to it . I have tried static util which returned class not found exception, while UtilLocator returned &amp;#34;no bean named ***RandomUtil&amp;#34; exception. Is there any other way to implement this?  </summary>
    <dc:creator>Sathish Kumar</dc:creator>
    <dc:date>2020-06-08T17:03:28Z</dc:date>
  </entry>
</feed>
