freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker-site git commit: Updated FAQ item regarding modifiable hashes/sequences
Date Mon, 09 Jan 2017 13:33:13 GMT
Repository: incubator-freemarker-site
Updated Branches:
  refs/heads/asf-site e3d8b3861 -> 185fac215


Updated FAQ item regarding modifiable hashes/sequences


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/commit/185fac21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/tree/185fac21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/diff/185fac21

Branch: refs/heads/asf-site
Commit: 185fac215e9c6bad88ed1cc23cc2aa2c775d1ee4
Parents: e3d8b38
Author: ddekany <ddekany@apache.org>
Authored: Mon Jan 9 14:32:13 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Mon Jan 9 14:32:13 2017 +0100

----------------------------------------------------------------------
 docs/app_faq.html | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/185fac21/docs/app_faq.html
----------------------------------------------------------------------
diff --git a/docs/app_faq.html b/docs/app_faq.html
index da9b6f8..e4e91ec 100644
--- a/docs/app_faq.html
+++ b/docs/app_faq.html
@@ -1258,11 +1258,26 @@ ga('send', 'pageview');
             anyway.</p>
 
             <p>Now, if you still say you need to modify sequences/hashes
-            directly with the FreeMarker template, here are two solutions, but
-            please read the warning after them:</p>
+            directly with the FreeMarker template, here are some solutions,
+            but please read the warning after them:</p>
 
             <ul>
               <li>
+                <p>You can access the Java API of a
+                <code class="inline-code">java.util.Map</code> with the help
of the
+                <code class="inline-code">api</code> built-in, like
+                <code class="inline-code">myMap?api.put(11, &quot;eleven&quot;)</code>.
You will need
+                to get a <code class="inline-code">Map</code> from somewhere
though (an FTL
+                hash literal like <code class="inline-code">{}</code> won&#39;t
suffice, as it&#39;s
+                read only and doesn&#39;t support <code class="inline-code">api</code>
either).
+                For example, you could expose a Java method or
+                <code class="inline-code">TemplateMethodModelEx</code> to the
template that
+                returns a <code class="inline-code">new LinkeHashMap()</code>,
so you can do
+                <code class="inline-code">&lt;#assign myMap =
+                utils.newLinkedHashMap()&gt;</code>.</p>
+              </li>
+
+              <li>
                 <p>You can write a <code class="inline-code">TemplateMethodModelEx</code>
                 and <code class="inline-code">TemplateDirectiveModel</code> implementation
                 that can modify certain types of sequences/hashes. Just
@@ -1289,13 +1304,8 @@ ga('send', 'pageview');
 
               <li>
                 <p>A sequence can have some methods/directives if you use a
-                customized wrapper (so you can <code class="inline-code">&lt;@myList.append
foo
-                /&gt;</code>). (Also, if you use
-                <code class="inline-code">BeansWrapper</code> and configure it
so it exposes
-                the public methods, you can use the Java API for variables
-                that are for <code class="inline-code">java.util.Map</code>-s
and
-                <code class="inline-code">java.util.List-s</code>. Just like
with Apache
-                Velocity.)</p>
+                customized wrapper (so you can write something like
+                <code class="inline-code">&lt;@myList.append foo /&gt;</code>).</p>
               </li>
             </ul>
 
@@ -1766,9 +1776,11 @@ TemplateModel x = env.getVariable(&quot;x&quot;);  // get variable
x</pre></div>
   </div>
 <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow
previous" href="app.html"><span>Previous</span></a><a class="paging-arrow
next" href="app_versions.html"><span>Next</span></a></div></div></div></div>
     </div>
     </div>
-<div class="site-footer"><div class="site-width"><div class="footer-top"><div
class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a
href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a
href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About
us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div
class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a
href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a
href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a
href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a
href="ref_specvar.html">.special_vars</a></li></ul></div><div
class="column"><h3 class="column-header">Community</h3><ul><li><a
href
 ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a
href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a
href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a
href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a
href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div
class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a
class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a
class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack
Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/"
rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML
Editor</span></a></div></div><div class="footer-bottom"><p><span
class="generated-for-product">Generated for:
  Freemarker 2.3.25</span><span class="last-updated"> Last generated:
-<time itemprop="dateModified" datetime="2016-11-11T19:51:37Z" title="Friday, November
11, 2016 7:51:37 PM GMT">2016-11-11 19:51:37 GMT</time></span></p> <p
class="copyright">
-© <span itemprop="copyrightYear">1999</span>–2016
-<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://freemarker.org">The
Apache Software Foundation</a>. All rights reserved. </p>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div
class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a
href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a
href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About
us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div
class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a
href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a
href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a
href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a
href="ref_specvar.html">.special_vars</a></li></ul></div><div
class="column"><h3 class="column-header">Community</h3><ul><li><a
href
 ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a
href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a
href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a
href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a
href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div
class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a
class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a
class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack
Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/"
rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML
Editor</span></a></div></div><div class="footer-bottom"> <p
class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-01-09T13:30:20Z" title="Monday, January 9,
2017 1:30:20 PM GMT">2017-01-09 13:30:20 GMT</time>, for Freemarker 2.3.25 </p>
+<p class="copyright">
+© <span itemprop="copyrightYear">1999</span>–2017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://freemarker.org">The
Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache,
the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
 </div></div></div></body>
 </html>


Mime
View raw message