Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Velocity 解析包含速度公式的变量_Velocity - Fatal编程技术网

Velocity 解析包含速度公式的变量

Velocity 解析包含速度公式的变量,velocity,Velocity,我有个问题。我需要解析一个包含速度公式的变量,例如 set($test = $tests.get("test1")) $test 而$tests.get(“test1”)返回一个速度公式,但它不起作用 我试图使用parse,但它是用于文件的,我从数据库中检索$tests.get(“test1”)它,我无法将它保存到文件中。我还尝试使用#evaluate,但它没有任何作用 这是我的html: // test now contains a velocity formula #set($test =

我有个问题。我需要解析一个包含速度公式的变量,例如

set($test = $tests.get("test1"))
$test
$tests.get(“test1”)
返回一个速度公式,但它不起作用

我试图使用
parse
,但它是用于文件的,我从数据库中检索
$tests.get(“test1”)
它,我无法将它保存到文件中。我还尝试使用
#evaluate
,但它没有任何作用

这是我的html:

// test now contains a velocity formula
#set($test = $sections.get("test"))  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
#evaluate($test)
</html>
//测试现在包含一个速度公式
#set($test=$sections.get(“test”))
#评估($test)

你能展示一个公式示例以及你是如何使用
#evaluate
的吗?是的,这正是#evaluate的目的。另一种选择是Velocity工具中的RenderTool。您可能使用了#evaluate错误。