You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ma...@apache.org on 2004/01/31 15:16:33 UTC
cvs commit: jakarta-velocity-tools/xdocs/view ViewRenderTool.xml
marino 2004/01/31 06:16:33
Added: xdocs/view ViewRenderTool.xml
Log:
New documentation for the CookieTool, ImportTool and ViewRenderTool
Revision Changes Path
1.1 jakarta-velocity-tools/xdocs/view/ViewRenderTool.xml
Index: ViewRenderTool.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>ViewRenderTool</title>
<author email="sidler@apache.org">Gabriel Sidler</author>
<projectfile>xdocs/view/menu.xml</projectfile>
</properties>
<body>
<section name="ViewRenderTool Reference Documentation">
<p>This tool exposes methods to evaluate the given strings as VTL
(Velocity Template Language) and automatically using the current context.</p>
<toolinfo>
<version>@@@version@@@, @@@date@@@</version>
<clazz>org.apache.velocity.tools.view.tools.ViewRenderTool</clazz>
<name>$render</name>
<author email="nathan@esha.com">Nathan Bubna</author>
<config-example><tool>
<key>render</key>
<scope>request</scope>
<class>org.apache.velocity.tools.view.tools.ViewRenderTool</class>
</tool></config-example>
</toolinfo>
<methods/>
</section>
<section name="eval()">
<method name="eval()">
<abstract>
Evaluates a String containing VTL using the current context, and
returns the result as a String.
</abstract>
<signature>
String eval(String vtl)
</signature>
<parameters>
<parameter name="vtl">
The code to be evaluated.
</parameter>
</parameters>
<returns>
The evaluated code as a String.
</returns>
<description>
<p>Evaluates a String containing VTL using the current context, and
returns the result as a String. If this fails, then <code>null</code>
will be returned. This evaluation is not recursive.</p>
<sourcecode>#set( $list = [1,2,3] )
#set( $object = '$list' )
#set( $method = 'size()' )
$render.eval("${object}.$method")</sourcecode>
<p>This will produce the following output:</p>
<sourcecode>3</sourcecode>
</description>
</method>
</section>
<section name="recurse()">
<method name="recurse()">
<abstract>
Recursively evaluates a String containing VTL using the
current context, and returns the result as a String.
</abstract>
<signature>
String recurse(String vtl)
</signature>
<parameters>
<parameter name="vtl">
The code to be evaluated.
</parameter>
</parameters>
<returns>
The evaluated code as a String
</returns>
<description>
<p>Recursively evaluates a String containing VTL using the
current context, and returns the result as a String. It
will continue to re-evaluate the output of the last
evaluation until an evaluation returns the same code
that was fed into it.</p>
<sourcecode>#macro( say_hi )hello world!#end
#set( $foo = '#say_hi()' )
#set( $bar = '$foo' )
$render.recurse('$bar')</sourcecode>
<p>This will produce the following output:</p>
<sourcecode>hello world!</sourcecode>
</description>
</method>
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org