<?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: Custom models into templates in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39109#M20789</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The &amp;lt;r:template&amp;gt; component is a JSF (JavaServerFaces) UI component - use of these components cannot generally be mixed with JSP code directly. To supply your model, you need to bind the model value to a getter method on a JSF managed bean. E.g. something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;r:template id="t6" template="alfresco/templates/my_test.ftl" model="#{mybean.model}" /&amp;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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;Where &lt;/SPAN&gt;&lt;EM&gt;mybean&lt;/EM&gt;&lt;SPAN&gt; is declared in the "WEB-INF/faces-config-custom.xml" file and &lt;/SPAN&gt;&lt;EM&gt;model&lt;/EM&gt;&lt;SPAN&gt; binds to a getter method called &lt;/SPAN&gt;&lt;EM&gt;getModel()&lt;/EM&gt;&lt;SPAN&gt; on the bean. Take a look at BrowseBean or similar for examples of this pattern.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Jun 2006 11:03:28 GMT</pubDate>
    <dc:creator>kevinr</dc:creator>
    <dc:date>2006-06-19T11:03:28Z</dc:date>
    <item>
      <title>Custom models into templates</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39108#M20788</link>
      <description>I read in wiki (http://wiki.alfresco.com/wiki/Template_Guide) that custom model could be provided to template component as a Map of object. I don't uderstand how to make available this map to template tag. jsp page&amp;lt;%Map myModel = new HashMap();myModel.put("prop1", "foo");%&amp;gt;&amp;lt;r:template id="t</description>
      <pubDate>Sat, 17 Jun 2006 17:12:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39108#M20788</guid>
      <dc:creator>andrepra</dc:creator>
      <dc:date>2006-06-17T17:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Custom models into templates</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39109#M20789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The &amp;lt;r:template&amp;gt; component is a JSF (JavaServerFaces) UI component - use of these components cannot generally be mixed with JSP code directly. To supply your model, you need to bind the model value to a getter method on a JSF managed bean. E.g. something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;r:template id="t6" template="alfresco/templates/my_test.ftl" model="#{mybean.model}" /&amp;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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;Where &lt;/SPAN&gt;&lt;EM&gt;mybean&lt;/EM&gt;&lt;SPAN&gt; is declared in the "WEB-INF/faces-config-custom.xml" file and &lt;/SPAN&gt;&lt;EM&gt;model&lt;/EM&gt;&lt;SPAN&gt; binds to a getter method called &lt;/SPAN&gt;&lt;EM&gt;getModel()&lt;/EM&gt;&lt;SPAN&gt; on the bean. Take a look at BrowseBean or similar for examples of this pattern.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Jun 2006 11:03:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39109#M20789</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2006-06-19T11:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Custom models into templates</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39110#M20790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks. I saw that the bean i have to develope is a common bean, i mean that has no inheritance. How can i retrieve something (parameters or attributes) from the http request to pass them to the template?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;public Map getTemplateModel() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HashMap model = new HashMap(1, 1.0f);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // retrieving ref from the request&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String nodeRef = [request.getParameter("….")]&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model.put("documentRef", nodeRef);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return model;&lt;BR /&gt;&amp;nbsp; }&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Jun 2006 17:13:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-models-into-templates/m-p/39110#M20790</guid>
      <dc:creator>andrepra</dc:creator>
      <dc:date>2006-06-19T17:13:32Z</dc:date>
    </item>
  </channel>
</rss>

