2014-10-01 134 views
0

为什么我收到此错误:当使用Velocity模板与把手

org.apache.velocity.exception.ParseErrorException: Encountered "btnBreakPrivateStartDisabled" at /templates/przerwy/askbreaks.vm[line 14, column 97] 
Was expecting: 
"(" ... 

这样的:

<input type="button" id="button_break_private_start" class="breakButtons" 
{{#if btnBreakPrivateStartDisabled}}disabled{{/if}} 
value="$action.getText('break.ask.private')" 
onclick="window.location.href='$req.contextPath/plugins/requests/requestprivatebreak.action'"/> 

回答

2

#if被解释为Velocity directive,由于括号围绕所需Velocity语法中的条件表达式会产生您在上面看到的错误。你的语法表明你的意思是#if指令由Handlebars处理。目前还不清楚你是如何调用把手的,但是如果你需要在你的输出中代表文字#if,你可以escape the #

请注意,Confluence已经内置支持Soy templates(Google Closure模板)。如果这些可能符合你的需求代替Handlebars,它们将允许你直接编写.soy模板,而无需通过Velocity并且不必担心逃跑。