<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Access Java Class with Freemarker Template in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150299#M105184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Freemarker uses the MVC (Model View Controller) pattern, you can use Java to prepare the data and then use Freemarker to display it. You can read more at the Freemarker site, freemarker.org.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nancy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Apr 2008 17:45:42 GMT</pubDate>
    <dc:creator>nancyg</dc:creator>
    <dc:date>2008-04-28T17:45:42Z</dc:date>
    <item>
      <title>Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150297#M105182</link>
      <description>Hey everybody,is there a possibility to run Java code from an Freemarker template? Does anybody has an example or tutorial for this or is there another workaround to access java classes?Regards,Christian</description>
      <pubDate>Mon, 28 Apr 2008 13:30:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150297#M105182</guid>
      <dc:creator>major_king</dc:creator>
      <dc:date>2008-04-28T13:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150298#M105183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure about Freemarker (I haven't used it very much), but it's definitely possible to have Java code run as XSLT extensions if you're using XSLT as the templating language. At least, I've had in working with web forms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sam.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 16:06:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150298#M105183</guid>
      <dc:creator>samuel_penn</dc:creator>
      <dc:date>2008-04-28T16:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150299#M105184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Freemarker uses the MVC (Model View Controller) pattern, you can use Java to prepare the data and then use Freemarker to display it. You can read more at the Freemarker site, freemarker.org.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nancy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 17:45:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150299#M105184</guid>
      <dc:creator>nancyg</dc:creator>
      <dc:date>2008-04-28T17:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150300#M105185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for fast answering. Now I spend some time on browsing some forums and guids and i found out the Freemarker Beanwrapper. With this it should be possible to call Java-code. Has anybody already done this? I'm struggling with the syntax atm &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Christian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 12:59:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150300#M105185</guid>
      <dc:creator>major_king</dc:creator>
      <dc:date>2008-04-29T12:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150301#M105186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;what helped me the most when trying to wrap my head around the issue was to find somethign that Alfresco already does and try to replicate it. For instance I needed to put a new item on the Sidebar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I looked at the existing Sidebar jsps, which are navigator, shelf and opensearch.jsp. Now look at examples under the dashlets jsps, some of which call templates for their rendering.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For me it was more helpful to use the existing stuff and modifying it to see what it would do, than try to read a wiki page to understand it all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope that helps a little.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2008 20:23:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150301#M105186</guid>
      <dc:creator>poptarts</dc:creator>
      <dc:date>2008-05-01T20:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150302#M105187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is really quite powerfull and easy to do once&amp;nbsp; you have it setup.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are a few items you must be aware of.&amp;nbsp; Here's how I did it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;* Create the javabean according to java standards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* Add the javabean to the freemarker model.&amp;nbsp; I did this by creating my own servlet the extended GuestTemplateContentServlet and extending the buildModel method.&amp;nbsp; This method is what is used by alfresco add the alfresco java beans to the root model.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* I then added my own javabeans that did whatever I needed them to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So for example you had a Javabean with a getTotal() method and you added it to the HashMap with an id of "calc".&amp;nbsp; In the template you would simply say:&amp;nbsp; ${calc.total} once the javabean is added to the root Hashmap.&amp;nbsp; Take a look at the org.alfresco.web.app.servlet.GuestTemplateContentServlet.&amp;nbsp; Turn on it's debugging in you wish and you will see how it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The total method can return most any java.lang data type as well as List or Map interfaces.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:31:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150302#M105187</guid>
      <dc:creator>nyronian</dc:creator>
      <dc:date>2008-05-06T14:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150303#M105188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Samual….how do you do this in XSLT.&amp;nbsp; I researched this about a year ago and found NOTHING on it.&amp;nbsp; I posted on the Alfresco forums before and did not get many answers of how to expose java objects to the XSLT engine, so at the time I went all Freemarker because it talks about it natively.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.alfresco.com/viewtopic.php?f=3&amp;amp;t=6340" rel="nofollow noopener noreferrer"&gt;http://forums.alfresco.com/viewtopic.php?f=3&amp;amp;t=6340&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you point me to the documentation on how to do this in XSLT?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 14:39:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150303#M105188</guid>
      <dc:creator>nyronian</dc:creator>
      <dc:date>2008-05-06T14:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150304#M105189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem I had was trying to get the XSLT to pick up the Java class. In the end, the only way I found to do that was to stick the class in the Tomcat shared classes folder - placing the class in the web project itself (even if in a WEB-INF) didn't work. Once that has been done, then it's just a standard Xalan extension, which is documented on the Apache Xalan site.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got a simple example on my laptop which I'll try and dig out and put up later today.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sam.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 15:02:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150304#M105189</guid>
      <dc:creator>samuel_penn</dc:creator>
      <dc:date>2008-05-06T15:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150305#M105190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this version of things works. It just uses a Java class to perform a simple arithmetical operation based on the form data (what I actually needed to do was display logs and square roots of some data, which XSLT doesn't do easily, but my implementation of that has been put on hold) to prove that the concept worked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.glendale.org.uk/~sam/alfresco/plugin.xsd" rel="nofollow noopener noreferrer"&gt;http://www.glendale.org.uk/~sam/alfresco/plugin.xsd&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.glendale.org.uk/~sam/alfresco/plugin.xsl" rel="nofollow noopener noreferrer"&gt;http://www.glendale.org.uk/~sam/alfresco/plugin.xsl&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.glendale.org.uk/~sam/alfresco/PluginTest.java" rel="nofollow noopener noreferrer"&gt;http://www.glendale.org.uk/~sam/alfresco/PluginTest.java&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't had a chance to test these today, but I think they're the versions which worked. At the very least, it should give an idea of what you're supposed to do (the Java class can be run outside Alfresco to test the XSLT side). The class for PluginTest needs to be placed into the Tomcat classpath, and the xsd/xsl used to define a web form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sam.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 21:58:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150305#M105190</guid>
      <dc:creator>samuel_penn</dc:creator>
      <dc:date>2008-05-06T21:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150306#M105191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot for all these answers. I will try them out &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;christian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 06:39:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150306#M105191</guid>
      <dc:creator>major_king</dc:creator>
      <dc:date>2008-05-07T06:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150307#M105192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for all developers who will have the same problem, i will post my results &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I does not get it work to access the Java class with Freemarker &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt; Now i call my Java-Code directly from the jsp-page via JavaServer Faces. For more Information send me a PM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Christian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 08:56:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150307#M105192</guid>
      <dc:creator>major_king</dc:creator>
      <dc:date>2008-05-29T08:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150308#M105193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Major,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;iam trying to write Java backed Restful API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i followed the following steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1). helloworld.get.desc.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2). HelloWorld.java&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3). helloworld-scripts-context.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4). helloworld.get.html.ftl&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5). created HelloWorld.class jar file and placed in &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;WEB-INF\lib&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;6). copied helloworld-scripts-context.xml in &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;shared\classes\alfresco\extension&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;7). removed alfresco.war&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;8). restarted Tomcat server&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9). created helloworld.get.desc.xml &amp;amp; helloworld.get.html.ftl in DataDictionary/WebScripts-extension space&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10). run the Restful API like - &lt;/SPAN&gt;&lt;A href="http://localhost:8080/alfresco/service/helloworld?name={nameArgument}" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/helloworld?name={nameArgument}&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;11). &lt;/SPAN&gt;&lt;STRONG&gt;System.out.print(…) in java file are not getting printed on Tomcat console.&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess java class is not at all getting invoked. could any body pls answer how to link Java class and FreeMarker Template?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following are the source files:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1). &lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;helloworld.get.dec.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;webscript&amp;gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;shortname&amp;gt; Hello World &amp;lt;/shortname&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt; Hello World Web Script &amp;lt;/description&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;url&amp;gt; /helloworld?name={nameArgument} &amp;lt;/url&amp;gt;&lt;BR /&gt;&amp;lt;/webscript&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2). &lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;HelloWorld.java&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;package com.helloworld.scripts;&lt;BR /&gt;&lt;BR /&gt;import java.util.Map;&lt;BR /&gt;import java.util.HashMap;&lt;BR /&gt;import org.alfresco.web.scripts.DeclarativeWebScript;&lt;BR /&gt;import org.alfresco.web.scripts.WebScriptRequest;&lt;BR /&gt;import org.alfresco.web.scripts.WebScriptStatus;&lt;BR /&gt;&lt;BR /&gt;public class HelloWorld extends org.alfresco.web.scripts.DeclarativeWebScript&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;String nm="";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;protected Map&amp;lt;String, Object&amp;gt; executeImpl(WebScriptRequest wr, WebScriptStatus ws){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("from executeImpl()****************");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("hello****************");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Map&amp;lt;String, Object&amp;gt; model = new HashMap&amp;lt;String, Object&amp;gt;();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;model.put("foo", nm);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return model;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void setSomeName(String name){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nm=name;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3). &lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;helloworld-scripts-context.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;&lt;BR /&gt;&amp;lt;!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' '&lt;A href="http://www.springframework.org/dtd/spring-beans-2.0.dtd" rel="nofollow noopener noreferrer"&gt;http://www.springframework.org/dtd/spring-beans-2.0.dtd&lt;/A&gt;'&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;beans&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;bean id="webscript.com.scripts.helloworld.get" class="com.helloworld.scripts.HelloWorld" parent="webscript"&amp;gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;property name="someName"&amp;gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;value&amp;gt; This is a Foo Name &amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/property&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/bean&amp;gt; &lt;BR /&gt;&amp;lt;/beans&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4). &lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;helloworld.get.html.ftl&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;p&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Hello, ${args.name} &amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Foo : ${foo}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hans&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2008 11:57:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150308#M105193</guid>
      <dc:creator>hansraj</dc:creator>
      <dc:date>2008-11-17T11:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Access Java Class with Freemarker Template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150309#M105194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It is really quite powerfull and easy to do once&amp;nbsp; you have it setup.&lt;BR /&gt;&lt;BR /&gt;There are a few items you must be aware of.&amp;nbsp; Here's how I did it.&lt;BR /&gt;&lt;BR /&gt;* Create the javabean according to java standards.&lt;BR /&gt;* Add the javabean to the freemarker model.&amp;nbsp; I did this by creating my own servlet the extended GuestTemplateContentServlet and extending the buildModel method.&amp;nbsp; This method is what is used by alfresco add the alfresco java beans to the root model.&amp;nbsp; &lt;BR /&gt;* I then added my own javabeans that did whatever I needed them to.&lt;BR /&gt;&lt;BR /&gt;So for example you had a Javabean with a getTotal() method and you added it to the HashMap with an id of "calc".&amp;nbsp; In the template you would simply say:&amp;nbsp; ${calc.total} once the javabean is added to the root Hashmap.&amp;nbsp; Take a look at the org.alfresco.web.app.servlet.GuestTemplateContentServlet.&amp;nbsp; Turn on it's debugging in you wish and you will see how it works.&lt;BR /&gt;&lt;BR /&gt;The total method can return most any java.lang data type as well as List or Map interfaces.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you please post your custom GuestTemplateContentServlet.buildModel method code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I' m haveing the same problem. I want to be able to access pojo's from freemarker in Alfresco.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 09:18:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/access-java-class-with-freemarker-template/m-p/150309#M105194</guid>
      <dc:creator>pero</dc:creator>
      <dc:date>2010-06-08T09:18:31Z</dc:date>
    </item>
  </channel>
</rss>

